Ecto.Repo.get_by-exclamation-mark

You're seeing just the callback get_by-exclamation-mark, go back to Ecto.Repo module for more information.
Link to this callback

get_by!(queryable, clauses, opts)

View Source (optional)

Specs

get_by!(
  queryable :: Ecto.Queryable.t(),
  clauses :: Keyword.t() | map(),
  opts :: Keyword.t()
) :: Ecto.Schema.t()

Similar to get_by/3 but raises Ecto.NoResultsError if no record was found.

Raises if more than one entry.

Options

  • :prefix - The prefix to run the query on (such as the schema path in Postgres or the database in MySQL). This will be applied to all from and joins in the query that did not have a prefix previously given either via the :prefix option on join/from or via @schema_prefix in the schema. For more information see the "Query Prefix" section of the Ecto.Query documentation.

See the "Shared options" section at the module documentation for more options.

Example

MyRepo.get_by!(Post, title: "My post")

MyRepo.get_by!(Post, [title: "My post"], prefix: "public")