以下是使用Ecto搜索数据库记录时的结果:
jxxmbp:lookup carlson$ ./lookup --title foo
02:55:19.029 [debug] QUERY OK source="notes" db=2.3ms decode=2.2ms queue=45.1ms
SELECT n0."id", n0."title", n0."content" FROM "notes" AS n0 WHERE (n0."title" = $1) ["foo"]
但是我希望找到记录,而不是真相。
以下是相关代码:
def process({:title, arg}) do
Lookup.Note |> Ecto.Query.where(title: ^arg) |> Lookup.Repo.all
end