We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
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
If I want a query to return records for which the enum is either of two values, the following syntax should work:
Invitation |> where(type: ^[:expert, :investor]) |> Repo.all
I tried pretty much everything I could, it just simply doesn't work. I would have expected a type IN ... query to be generated, but it's not.
type IN ...
For now, the solution seems to be a or_where(...) construct, but it gets really messy with more constraints on other fields.
or_where(...)
The text was updated successfully, but these errors were encountered:
Does this work?
Invitation |> where([i], i.type in ^[:expert, :investor]) |> Repo.all
What kind of ecto_enum is this? Is it string-backed, integer-backed or does it use PG types?
Sorry, something went wrong.
|> where(type: ^[:expert, :investor])
Doesn't this form lose type information of what is being processed on the struct?
|> where([i], i.type in ^[:expert, :investor])
Where this style keeps type information (and thus ecto enum conversions)?
No branches or pull requests
If I want a query to return records for which the enum is either of two values, the following syntax should work:
I tried pretty much everything I could, it just simply doesn't work. I would have expected a
type IN ...
query to be generated, but it's not.For now, the solution seems to be a
or_where(...)
construct, but it gets really messy with more constraints on other fields.The text was updated successfully, but these errors were encountered: