PaperTrail behaviour (paper_trail v0.10.12)

Summary

Functions

See PaperTrail.Serializer.add_prefix/2.

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.

See PaperTrail.Serializer.get_item_type/1.

See PaperTrail.Serializer.get_model_id/1.

See PaperTrail.Serializer.get_sequence_from_model/2.

See PaperTrail.Serializer.get_sequence_id/2.

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.

See PaperTrail.Serializer.make_version_struct/3.

See PaperTrail.Serializer.serialize/2.

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.

Updates all records from the database with a related version insertion in one transaction

Types

Link to this type

all_result()

@type all_result() :: {integer(), nil | [any()]}
@type meta() :: map() | nil
Link to this type

multi_name()

@type multi_name() :: Ecto.Multi.name() | nil
@type options() ::
  []
  | [
      repo: repo(),
      strict_mode: strict_mode(),
      origin: origin(),
      meta: meta(),
      originator: originator(),
      prefix: prefix(),
      model_key: multi_name(),
      version_key: multi_name(),
      return_operation: multi_name(),
      returning: boolean(),
      repo_options: Keyword.t()
    ]
@type origin() :: String.t() | nil
Link to this type

originator()

@type originator() :: Ecto.Schema.t() | nil
@type prefix() :: String.t() | nil
@type queryable() :: Ecto.Queryable.t()
@type repo() :: module() | nil
@type result() :: {:ok, Ecto.Schema.t()} | {:error, Ecto.Changeset.t()}
Link to this type

strict_mode()

@type strict_mode() :: boolean() | nil
@type updates() :: Keyword.t()

Callbacks

Link to this callback

delete(t, options)

@callback delete(Ecto.Changeset.t(), options()) :: result()
Link to this callback

delete!(t, options)

@callback delete!(Ecto.Changeset.t(), options()) :: Ecto.Schema.t()
Link to this callback

get_current_model(t)

@callback get_current_model(PaperTrail.Version.t()) :: Ecto.Schema.t()
@callback get_version(Ecto.Schema.t()) :: Ecto.Query.t()
Link to this callback

get_version(module, any)

@callback get_version(module(), any()) :: Ecto.Query.t()
Link to this callback

get_version(module, any, keyword)

@callback get_version(module(), any(), keyword()) :: Ecto.Query.t()
Link to this callback

get_versions(t)

@callback get_versions(Ecto.Schema.t()) :: Ecto.Query.t()
Link to this callback

get_versions(module, any)

@callback get_versions(module(), any()) :: Ecto.Query.t()
Link to this callback

get_versions(module, any, keyword)

@callback get_versions(module(), any(), keyword()) :: Ecto.Query.t()
Link to this callback

insert(t, options)

@callback insert(Ecto.Changeset.t(), options()) :: result()
Link to this callback

insert!(t, options)

@callback insert!(Ecto.Changeset.t(), options()) :: Ecto.Schema.t()
Link to this callback

update(t, options)

@callback update(Ecto.Changeset.t(), options()) :: result()
Link to this callback

update!(t, options)

@callback update!(Ecto.Changeset.t(), options()) :: Ecto.Schema.t()
Link to this callback

update_all(queryable, updates, options)

@callback update_all(queryable(), updates(), options()) :: all_result()

Functions

Link to this function

add_prefix(changeset, prefix)

See PaperTrail.Serializer.add_prefix/2.

Link to this function

delete(struct, options \\ [])

@spec delete(Ecto.Changeset.t(), options()) :: result()

Deletes a record from the database with a related version insertion in one transaction

Link to this function

delete!(struct, options \\ [])

@spec delete!(Ecto.Schema.t(), options()) :: Ecto.Schema.t()

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, options \\ [])

See PaperTrail.VersionQueries.get_current_model/2.

Link to this function

get_item_type(data)

See PaperTrail.Serializer.get_item_type/1.

Link to this function

get_model_id(model)

See PaperTrail.Serializer.get_model_id/1.

Link to this function

get_sequence_from_model(changeset, options \\ [])

See PaperTrail.Serializer.get_sequence_from_model/2.

Link to this function

get_sequence_id(table_name, options \\ [])

See PaperTrail.Serializer.get_sequence_id/2.

Link to this function

get_version(record)

See PaperTrail.VersionQueries.get_version/1.

Link to this function

get_version(model_or_record, id_or_options)

See PaperTrail.VersionQueries.get_version/2.

Link to this function

get_version(model, id, options)

See PaperTrail.VersionQueries.get_version/3.

Link to this function

get_versions(record)

See PaperTrail.VersionQueries.get_versions/1.

Link to this function

get_versions(model_or_record, id_or_options)

See PaperTrail.VersionQueries.get_versions/2.

Link to this function

get_versions(model, id, options)

See PaperTrail.VersionQueries.get_versions/3.

Link to this function

insert(changeset, options \\ [])

@spec insert(Ecto.Changeset.t(), options()) :: result()

Inserts a record to the database with a related version insertion in one transaction

Link to this function

insert!(changeset, options \\ [])

@spec insert!(Ecto.Schema.t(), options()) :: Ecto.Schema.t()

Same as insert/2 but returns only the model struct or raises if the changeset is invalid.

Link to this function

make_version_struct(version, model, options)

See PaperTrail.Serializer.make_version_struct/3.

Link to this function

serialize(data, options)

See PaperTrail.Serializer.serialize/2.

Link to this function

update(changeset, options \\ [])

@spec update(Ecto.Changeset.t(), options()) :: result()

Updates a record from the database with a related version insertion in one transaction

Link to this function

update!(changeset, options \\ [])

@spec update!(Ecto.Schema.t(), options()) :: Ecto.Schema.t()

Same as update/2 but returns only the model struct or raises if the changeset is invalid.

Link to this function

update_all(queryable, updates, options \\ [])

@spec update_all(queryable(), updates(), options()) :: all_result()

Updates all records from the database with a related version insertion in one transaction