here, you will get Item as _query, you can replace
from(query in Item) with (from i in query) and you can add where with a comma so the result would be
defp search(query, name) do
from i in query, where: ilike(i.name, ^"%#{name}%")
end
t is not a real variable, because where is not a function, it’s a macro. t is part of the syntax of the macro. Examples here: Ecto.Query — Ecto v3.14.0
The where macro basically just creates a t that you can use in the second part of where.
Yes. If you pipe a query struct into where, it grabs the schema you’re querying out of the query and makes it available as whatever variable you put in the list.