Limited query-ability.
hickscorp opened this issue · 2 comments
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.
For now, the solution seems to be a or_where(...)
construct, but it gets really messy with more constraints on other fields.
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?
|> 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)?