Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

in_ and notIn on multiple columns #129

Open
jhickner opened this issue Feb 5, 2016 · 1 comment
Open

in_ and notIn on multiple columns #129

jhickner opened this issue Feb 5, 2016 · 1 comment

Comments

@jhickner
Copy link

jhickner commented Feb 5, 2016

In SQL, a query like this is valid:

update people set active = false where (id, name) not in ((1, 'Jason'), (3, 'Fred'))

But I'm having trouble constructing that with esqueleto. Here's what I've tried:

update pairs $ p -> do
    set p [ PersonActive =. val False ]
    where_ $ 
      (p ^. PersonId, p ^. PersonName)
      `notIn`
      valList pairs

where pairs is [ (PersonId, Text) ]

But that throws a lot of errors, starting with:

    Couldn't match type ‘SqlExpr’
                   with ‘(,) (SqlExpr (E.Value (Key PersonId)))’

Is it possible to construct this type of query in esqueleto?

Thanks!

@meteficha
Copy link
Member

Currently that's not possible. If you really need it, you may try playing with in_'s implementation (see here and here).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants