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
all_result()
meta()
@type meta() :: map() | nil
multi_name()
@type multi_name() :: Ecto.Multi.name() | nil
options()
@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() ]
origin()
@type origin() :: String.t() | nil
originator()
@type originator() :: Ecto.Schema.t() | nil
prefix()
@type prefix() :: String.t() | nil
queryable()
@type queryable() :: Ecto.Queryable.t()
repo()
@type repo() :: module() | nil
result()
@type result() :: {:ok, Ecto.Schema.t()} | {:error, Ecto.Changeset.t()}
strict_mode()
@type strict_mode() :: boolean() | nil
updates()
@type updates() :: Keyword.t()
Callbacks
delete(t, options)
@callback delete(Ecto.Changeset.t(), options()) :: result()
delete!(t, options)
@callback delete!(Ecto.Changeset.t(), options()) :: Ecto.Schema.t()
get_current_model(t)
@callback get_current_model(PaperTrail.Version.t()) :: Ecto.Schema.t()
get_version(t)
@callback get_version(Ecto.Schema.t()) :: Ecto.Query.t()
get_version(module, any)
@callback get_version(module(), any()) :: Ecto.Query.t()
get_version(module, any, keyword)
@callback get_version(module(), any(), keyword()) :: Ecto.Query.t()
get_versions(t)
@callback get_versions(Ecto.Schema.t()) :: Ecto.Query.t()
get_versions(module, any)
@callback get_versions(module(), any()) :: Ecto.Query.t()
get_versions(module, any, keyword)
@callback get_versions(module(), any(), keyword()) :: Ecto.Query.t()
insert(t, options)
@callback insert(Ecto.Changeset.t(), options()) :: result()
insert!(t, options)
@callback insert!(Ecto.Changeset.t(), options()) :: Ecto.Schema.t()
update(t, options)
@callback update(Ecto.Changeset.t(), options()) :: result()
update!(t, options)
@callback update!(Ecto.Changeset.t(), options()) :: Ecto.Schema.t()
update_all(queryable, updates, options)
@callback update_all(queryable(), updates(), options()) :: all_result()
Functions
add_prefix(changeset, prefix)
See PaperTrail.Serializer.add_prefix/2
.
delete(struct, options \\ [])
@spec delete(Ecto.Changeset.t(), options()) :: result()
Deletes a record from the database with a related version insertion in one transaction
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.
get_current_model(version, options \\ [])
get_item_type(data)
See PaperTrail.Serializer.get_item_type/1
.
get_model_id(model)
See PaperTrail.Serializer.get_model_id/1
.
get_sequence_from_model(changeset, options \\ [])
See PaperTrail.Serializer.get_sequence_from_model/2
.
get_sequence_id(table_name, options \\ [])
See PaperTrail.Serializer.get_sequence_id/2
.
get_version(record)
get_version(model_or_record, id_or_options)
get_version(model, id, options)
get_versions(record)
get_versions(model_or_record, id_or_options)
get_versions(model, id, options)
insert(changeset, options \\ [])
@spec insert(Ecto.Changeset.t(), options()) :: result()
Inserts a record to the database with a related version insertion in one transaction
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.
make_version_struct(version, model, options)
See PaperTrail.Serializer.make_version_struct/3
.
serialize(data, options)
See PaperTrail.Serializer.serialize/2
.
update(changeset, options \\ [])
@spec update(Ecto.Changeset.t(), options()) :: result()
Updates a record from the database with a related version insertion in one transaction
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.
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