paper_trail v0.7.9 PaperTrail.VersionQueries

Link to this section Summary

Functions

Gets the current model record/struct of a version

Gets the last version of a record

Gets the last version of a record

Gets the last version of a record given its module reference and its id

Gets all the versions of a record

Gets all the versions of a record

Gets all the versions of a record given a module and its id

Link to this section Functions

Link to this function get_current_model(version)

Gets the current model record/struct of a version

Link to this function get_version(record)
get_version(record :: Ecto.Schema.t) :: Ecto.Query.t

Gets the last version of a record.

Link to this function get_version(model, id)
get_version(record :: Ecto.Schema.t, options :: []) :: Ecto.Query.t
get_version(model :: module, id :: pos_integer) :: Ecto.Query.t

Gets the last version of a record.

A list of options is optional, so you can set for example the :prefix of the query, wich allows you to change between different tenants.

Usage example:

iex(1)> PaperTrail.VersionQueries.get_version(record, [prefix: “tenant_id”])

Link to this function get_version(model, id, options)
get_version(model :: module, id :: pos_integer, options :: []) :: Ecto.Query.t

Gets the last version of a record given its module reference and its id.

A list of options is optional, so you can set for example the :prefix of the query, wich allows you to change between different tenants.

Usage example:

iex(1)> PaperTrail.VersionQueries.get_version(ModelName, id, [prefix: “tenant_id”])

Link to this function get_versions(record)
get_versions(record :: Ecto.Schema.t) :: Ecto.Query.t

Gets all the versions of a record.

Link to this function get_versions(model, id)
get_versions(record :: Ecto.Schema.t, options :: []) :: Ecto.Query.t
get_versions(model :: module, id :: pos_integer) :: Ecto.Query.t

Gets all the versions of a record.

A list of options is optional, so you can set for example the :prefix of the query, wich allows you to change between different tenants.

Usage example:

iex(1)> PaperTrail.VersionQueries.get_versions(record, [prefix: “tenant_id”])

Link to this function get_versions(model, id, options)
get_versions(model :: module, id :: pos_integer, options :: []) :: Ecto.Query.t

Gets all the versions of a record given a module and its id.

A list of options is optional, so you can set for example the :prefix of the query, wich allows you to change between different tenants.

Usage example:

iex(1)> PaperTrail.VersionQueries.get_versions(ModelName, id, [prefix: “tenant_id”])