Bindingless Ecto Queries &

How would I write this query, in bindingless syntax,

def find_where(model, ids), do:
  (from p in model, where: p.id in ^ids) 
  |> AllIAsk.Repo.all

i.e., something like,

def find_where(model, ids), do:
  model
  |> (where: id: in ^ids) 
  |> AllIAsk.Repo.all

or

def find_where(model, ids), do:
  model
  |> (where: in(:id, ids)) 
  |> AllIAsk.Repo.all

?

Using the where macro directly it would look like:

schema
|> where([m], m.id in ^id)
|> Repo.all()

It’s not possible to express this query omitting bindings completely.

2 Likes

thanks!