Personally (and that’s about all it is imho ), I find the pipe-based approach more readable as I don’t have to visually parse the line into its three parts, and it makes editing (and keeping it tidy after editing) a bit easier.
I do wish we could avoid the binding ([u]) parameter more often, though. It works nicely for equality checks:
iex(workorders@nebula)13> "users" |> where(age: 18)
#Ecto.Query<from u in "users", where: u.age == 18>
But does not work when you want to do comparisons or for select/3 … so close!
Are there any docs about where bindings can be skipped? Defining the bindings is a complexity in composing queries, which would be quite nice to avoid.
It’s not necessarily all or nothing. I find that I have a good time with a mix of these. Ideally I’m bundling up queries into descriptive functions so that I can pipeline descriptive functions together to form a bigger picture:
You can find the documentation for bindingless queries in Ecto.Query documentation under bindingless operations. They are more suitable for dynamic purposes.