📜  phoenix 查询获取第一条记录 - Elixir 代码示例

📅  最后修改于: 2022-03-11 14:48:01.853000             🧑  作者: Mango

代码示例1
iex> Movie |> first() |> Repo.one()

SELECT m0."id", m0."title", m0."tagline" FROM "movies" AS m0 ORDER BY m0."id" LIMIT 1 []
%Friends.Movie{
  __meta__: #Ecto.Schema.Metadata<:loaded, "movies">,
  actors: #Ecto.Association.NotLoaded,
  characters: #Ecto.Association.NotLoaded,
  distributor: #Ecto.Association.NotLoaded,
  id: 1,
  tagline: "Something about video games",
  title: "Ready Player One"
}