PaperTrail.VersionQueries (paper_trail v0.10.12)
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.
Functions
get_current_model(version, options \\ [])
Gets the current model record/struct of a version
get_version(record)
@spec get_version(record :: Ecto.Schema.t()) :: Ecto.Query.t()
Gets the last version of a record.
get_version(model, id)
@spec get_version(model :: module(), id :: any()) :: Ecto.Query.t()
@spec get_version(record :: Ecto.Schema.t(), options :: keyword()) :: 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"])
get_version(model, id, options)
@spec get_version(model :: module(), id :: any(), options :: keyword()) :: 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"])
get_versions(record)
@spec get_versions(record :: Ecto.Schema.t()) :: Ecto.Query.t()
Gets all the versions of a record.
get_versions(model, id)
@spec get_versions(model :: module(), id :: any()) :: Ecto.Query.t()
@spec get_versions(record :: Ecto.Schema.t(), options :: keyword()) :: 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"])
get_versions(model, id, options)
@spec get_versions(model :: module(), id :: any(), options :: keyword()) :: 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"])