Elixir + Ecto:简单的 WHERE != 查询
Elixir + Ecto: Simple WHERE != query
你 WHERE != "something"
在 Ecto 中的表现如何?我正在使用 postgres
这是我的(没用):
u = User |> Ecto.Query.where(id: not 444) |> MyApp.Repo.one
您需要使用 Ecto 查询宏来构建此查询。对于基于 "expression" 的语法,您可以传递一个列表作为第一个参数,其中包含您想要绑定表的名称:
User |> where([u], u.id != 444)
有关详细信息,请查看 documentation of where
。
你 WHERE != "something"
在 Ecto 中的表现如何?我正在使用 postgres
这是我的(没用):
u = User |> Ecto.Query.where(id: not 444) |> MyApp.Repo.one
您需要使用 Ecto 查询宏来构建此查询。对于基于 "expression" 的语法,您可以传递一个列表作为第一个参数,其中包含您想要绑定表的名称:
User |> where([u], u.id != 444)
有关详细信息,请查看 documentation of where
。