Ecto.Repo.get
You're seeing just the callback
get
, go back to Ecto.Repo module for more information.
Specs
get(queryable :: Ecto.Queryable.t(), id :: term(), opts :: Keyword.t()) :: Ecto.Schema.t() | nil
Fetches a single struct from the data store where the primary key matches the given id.
Returns nil
if no result was found. If the struct in the queryable
has no or more than one primary key, it will raise an argument error.
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 allfrom
andjoin
s in the query that did not have a prefix previously given either via the:prefix
option onjoin
/from
or via@schema_prefix
in the schema. For more information see the "Query Prefix" section of theEcto.Query
documentation.
See the "Shared options" section at the module documentation for more options.
Example
MyRepo.get(Post, 42)
MyRepo.get(Post, 42, prefix: "public")