EctoExtras.Repo behaviour (ecto_extras v0.1.3) View Source
Helper functions for Ecto.Repo
Link to this section Summary
Callbacks
Returns the average value of a column from the query result.
Returns count of objects from the query result.
Returns first object from the query result. By default ordered by the primary key.
The same as first
but raises Ecto.NoResultsError if object is not found.
Returns last object from the query result. By default ordered by the primary key.
The same as last
but raises Ecto.NoResultsError if object is not found.
Returns the maximum value of a column from the query result.
Returns the minimum value of a column from the query result.
Returns the sum of column values from the query result.
Link to this section Callbacks
Specs
avg(query :: Ecto.Queryable.t(), column :: atom()) :: term() | nil
Returns the average value of a column from the query result.
Specs
count(query :: Ecto.Queryable.t(), column :: atom()) :: term() | nil
Returns count of objects from the query result.
Specs
first(query :: Ecto.Queryable.t(), column :: atom()) :: Ecto.Schema.t() | nil
Returns first object from the query result. By default ordered by the primary key.
Specs
first!(query :: Ecto.Queryable.t(), column :: atom()) :: Ecto.Schema.t()
The same as first
but raises Ecto.NoResultsError if object is not found.
Specs
last(query :: Ecto.Queryable.t(), column :: atom()) :: Ecto.Schema.t() | nil
Returns last object from the query result. By default ordered by the primary key.
Specs
last!(query :: Ecto.Queryable.t(), column :: :id) :: Ecto.Schema.t()
The same as last
but raises Ecto.NoResultsError if object is not found.
Specs
max(query :: Ecto.Queryable.t(), column :: atom()) :: term() | nil
Returns the maximum value of a column from the query result.
Specs
min(query :: Ecto.Queryable.t(), column :: atom()) :: term() | nil
Returns the minimum value of a column from the query result.
Specs
sum(query :: Ecto.Queryable.t(), column :: atom()) :: term() | nil
Returns the sum of column values from the query result.