pagantis_elixir_tools v0.21.3 ElixirTools.Events.NotSentEvent
Schema used for saving not sent (due to a failure) events to DB.
They supposed to be resend later, after this a field is_sent
has to be set to true
Link to this section Summary
Functions
Gets all entities based on query. If no query is given, all entities are returned.
Callback implementation for ElixirTools.Schema.Behaviour.all/1
.
Creates a new MODULE struct by parameters and inserts it in the database when the values are valid
The same as create/1 but raises an error when validation fails.
Gets a struct from the database by providing the ID
Gets a struct from the database by providing the ID, raises Ecto.NoResultsError if no record was found
Gets the first record by key
: value
Gets the first record by key
: value
Inserts a struct into the database.
Inserts a struct in the database and throws an error when it fails.
Gets the last record (by inserted_at) where given field equals given value.
Returns nil
if nothing was found.
Creates a new changeset by providing map
. Returns a struct of the type with the defaults
set. Keep in mind that new/1
does not validate.
Preloads a field or multiple fields on a struct.
Returns the default repo
Alters the struct with the values and updates the database record. The first argument takes the original struct, the second a map with changes.
The same as update/2
but raises an error when validation fails.
Validates a map or struct.
Link to this section Types
external_reference()
Specs
external_reference() :: String.t()
id()
Specs
id() :: ElixirTools.Schema.id()
Specs
Link to this section Functions
all()
Specs
all() :: [t()]
Gets all entities based on query. If no query is given, all entities are returned.
all(queryable)
Specs
all(Ecto.Query.t()) :: [t()]
Callback implementation for ElixirTools.Schema.Behaviour.all/1
.
create(map \\ %{})
Specs
Creates a new MODULE struct by parameters and inserts it in the database when the values are valid
create!(map \\ %{})
Specs
The same as create/1 but raises an error when validation fails.
get(id)
Specs
get(ElixirTools.Schema.id()) :: t() | nil
Gets a struct from the database by providing the ID
get!(id)
Specs
get!(ElixirTools.Schema.id()) :: t() | no_return()
Gets a struct from the database by providing the ID, raises Ecto.NoResultsError if no record was found
get_by(queryable)
Specs
Gets the first record by key
: value
get_by!(queryable)
Specs
Gets the first record by key
: value
insert(struct)
Specs
Inserts a struct into the database.
insert!(struct)
Specs
Inserts a struct in the database and throws an error when it fails.
last(field, value)
Specs
Gets the last record (by inserted_at) where given field equals given value.
Returns nil
if nothing was found.
new(map \\ %{})
Specs
Creates a new changeset by providing map
. Returns a struct of the type with the defaults
set. Keep in mind that new/1
does not validate.
preload(struct, field, opts \\ [])
Specs
Preloads a field or multiple fields on a struct.
repo()
Specs
repo() :: module()
Returns the default repo
update(struct, map)
Specs
Alters the struct with the values and updates the database record. The first argument takes the original struct, the second a map with changes.
update!(struct, map)
Specs
The same as update/2
but raises an error when validation fails.
validate(map_or_struct)
Specs
validate(map() | t()) :: {:ok, Ecto.Changeset.t()} | {:error, [{}]}
Validates a map or struct.