PaperTrail.VersionQueries (paper_trail v0.14.4) View Source
Link to this section Summary
Functions
Gets the current model record/struct of a version
Gets the last version 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
Specs
get_current_model(version :: PaperTrail.Version.t()) :: Ecto.Schema.t() | nil
Gets the current model record/struct of a version
Specs
get_version(record :: Ecto.Schema.t()) :: PaperTrail.Version.t() | nil
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 examples:
iex(1)> PaperTrail.VersionQueries.get_version(record, id) iex(1)> PaperTrail.VersionQueries.get_version(record, [prefix: "tenant_id"]) iex(1)> PaperTrail.VersionQueries.get_version(ModelName, id) iex(1)> PaperTrail.VersionQueries.get_version(ModelName, id, [prefix: "tenant_id"])
Specs
get_version(model :: module(), id :: pos_integer()) :: PaperTrail.Version.t() | nil
get_version(record :: Ecto.Schema.t(), options :: keyword() | []) :: PaperTrail.Version.t() | nil
Specs
get_version(model :: module(), id :: pos_integer(), options :: keyword() | []) :: PaperTrail.Version.t() | nil
Specs
get_versions(record :: Ecto.Schema.t()) :: [PaperTrail.Version.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 examples:
iex(1)> PaperTrail.VersionQueries.get_versions(record) iex(1)> PaperTrail.VersionQueries.get_versions(record, [prefix: "tenant_id"]) iex(1)> PaperTrail.VersionQueries.get_versions(ModelName, id) iex(1)> PaperTrail.VersionQueries.get_versions(ModelName, id, [prefix: "tenant_id"])
Specs
get_versions(model :: module(), id :: pos_integer()) :: [PaperTrail.Version.t()]
get_versions(record :: Ecto.Schema.t(), options :: keyword() | []) :: [ PaperTrail.Version.t() ]
Gets all the versions of a record given a module and its id
Specs
get_versions(model :: module(), id :: pos_integer(), options :: keyword() | []) :: [ PaperTrail.Version.t() ]