View Source PaperTrail (paper_trail v1.1.2)
Link to this section Summary
Functions
Deletes a record from the database with a related version insertion in one transaction
Same as delete/2 but returns only the model struct or raises if the changeset is invalid.
Explicitly inserts a non-versioned already existing record into the Versions table
Inserts a record to the database with a related version insertion in one transaction
Same as insert/2 but returns only the model struct or raises if the changeset is invalid.
Upserts a record to the database with a related version insertion in one transaction.
Same as insert_or_update/2 but returns only the model struct or raises if the changeset is invalid.
Updates a record from the database with a related version insertion in one transaction
Same as update/2 but returns only the model struct or raises if the changeset is invalid.
Link to this section Functions
delete(model_or_changeset, options \\ [origin: nil, meta: nil, originator: nil, prefix: nil, model_key: :model, version_key: :version, ecto_options: []])
View Source@spec delete( model_or_changeset :: model | Ecto.Changeset.t(model), options :: Keyword.t() ) :: {:ok, %{model: model, version: PaperTrail.Version.t()}} | {:error, Ecto.Changeset.t(model) | term()} when model: struct()
Deletes a record from the database with a related version insertion in one transaction
delete!(model_or_changeset, options \\ [origin: nil, meta: nil, originator: nil, prefix: nil, model_key: :model, version_key: :version, ecto_options: []])
View Source@spec delete!( model_or_changeset :: model | Ecto.Changeset.t(model), options :: Keyword.t() ) :: model when model: struct()
Same as delete/2 but returns only the model struct or raises if the changeset is invalid.
initialise(model, options \\ [origin: nil, meta: nil, originator: nil, prefix: nil, version_key: :version])
View SourceExplicitly inserts a non-versioned already existing record into the Versions table
insert(changeset, options \\ [origin: nil, meta: nil, originator: nil, prefix: nil, model_key: :model, version_key: :version, ecto_options: []])
View Source@spec insert( changeset :: Ecto.Changeset.t(model), options :: Keyword.t() ) :: {:ok, %{model: model, version: PaperTrail.Version.t()}} | {:error, Ecto.Changeset.t(model) | term()} when model: struct()
Inserts a record to the database with a related version insertion in one transaction
insert!(changeset, options \\ [origin: nil, meta: nil, originator: nil, prefix: nil, model_key: :model, version_key: :version, ecto_options: []])
View Source@spec insert!(changeset :: Ecto.Changeset.t(model), options :: Keyword.t()) :: model when model: struct()
Same as insert/2 but returns only the model struct or raises if the changeset is invalid.
insert_or_update(changeset, options \\ [origin: nil, meta: nil, originator: nil, prefix: nil, model_key: :model, version_key: :version, ecto_options: []])
View Source@spec insert_or_update(changeset :: Ecto.Changeset.t(model), options :: Keyword.t()) :: {:ok, %{model: model, version: PaperTrail.Version.t()}} | {:error, Ecto.Changeset.t(model) | term()} when model: struct()
Upserts a record to the database with a related version insertion in one transaction.
insert_or_update!(changeset, options \\ [origin: nil, meta: nil, originator: nil, prefix: nil, model_key: :model, version_key: :version, ecto_options: []])
View Source@spec insert_or_update!(changeset :: Ecto.Changeset.t(model), options :: Keyword.t()) :: model when model: struct()
Same as insert_or_update/2 but returns only the model struct or raises if the changeset is invalid.
update(changeset, options \\ [origin: nil, meta: nil, originator: nil, prefix: nil, model_key: :model, version_key: :version, ecto_options: []])
View Source@spec update(changeset :: Ecto.Changeset.t(model), options :: Keyword.t()) :: {:ok, %{model: model, version: PaperTrail.Version.t()}} | {:error, Ecto.Changeset.t(model) | term()} when model: struct()
Updates a record from the database with a related version insertion in one transaction
update!(changeset, options \\ [origin: nil, meta: nil, originator: nil, prefix: nil, model_key: :model, version_key: :version, ecto_options: []])
View Source@spec update!(changeset :: Ecto.Changeset.t(model), options :: Keyword.t()) :: model when model: struct()
Same as update/2 but returns only the model struct or raises if the changeset is invalid.