View Source PaperTrail (paper_trail v1.0.0)

Link to this section Summary

Functions

Link to this section Functions

Link to this function

add_prefix(schema, prefix)

View Source

See PaperTrail.Serializer.add_prefix/2.

Link to this function

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

Link to this function

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.

Link to this function

get_current_model(version)

View Source

See PaperTrail.VersionQueries.get_current_model/1.

See PaperTrail.Serializer.get_item_type/1.

See PaperTrail.Serializer.get_model_id/1.

Link to this function

get_sequence_id(table_name)

View Source

See PaperTrail.Serializer.get_sequence_id/1.

See PaperTrail.VersionQueries.get_version/1.

Link to this function

get_version(model_or_record, id_or_options)

View Source

See PaperTrail.VersionQueries.get_version/2.

Link to this function

get_version(model, id, options)

View Source

See PaperTrail.VersionQueries.get_version/3.

See PaperTrail.VersionQueries.get_versions/1.

Link to this function

get_versions(model_or_record, id_or_options)

View Source

See PaperTrail.VersionQueries.get_versions/2.

Link to this function

get_versions(model, id, options)

View Source

See PaperTrail.VersionQueries.get_versions/3.

Link to this function

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

Link to this function

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.

Link to this function

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.

Link to this function

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.

Link to this function

make_version_struct(version, model, options)

View Source

See PaperTrail.Serializer.make_version_struct/3.

See PaperTrail.Serializer.serialize/1.

Link to this function

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

Link to this function

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.