TIL: binding positions as parameters
Today I learned: you can specify a binding position in an Ecto query via parameter:
def apply_some_filter(query, binding_position, field_name) do
from([{rel, binding_position}] in query, where: field(rel, ^field_name) == "foo")
end
This works thanks to pattern matching 😍