EctoCellar (EctoCellar v0.4.0)

Core module for EctoCellar. Handles versions table created by mix ecto_cellar.gen. You can use this module to store in the cellar and restore the version.

options

Options

  • repo: You can select a repo other than the one specified in Config.

Link to this section Summary

Functions

Returns all versions of model from the cellar.

Deletes given changeset and stores the changes at that time in the cellar.

Inserts given model(or changeset) and stores the changes at that time in the cellar.

Returns a specific version of model from the cellar.

Stores the changes at that time in the cellar.

Like store/2, except that if the record is invalid, raises an exception.

Updates given changeset and stores the changes at that time in the cellar.

Inserts or updates given changeset and stores the changes at that time in the cellar.

Link to this section Types

Specs

options() :: Keyword.t()

Link to this section Functions

Link to this function

all(model, opts \\ [])

Specs

all(
  struct(),
  options()
) :: [Ecto.Schema.t()]

Returns all versions of model from the cellar.

Link to this function

delete_store(changeset, opts \\ [], delete_opts \\ [])

Specs

delete_store(Ecto.Schema.t() | Ecto.Changeset.t(), options(), Keyword.t()) ::
  {:ok, Ecto.Schema.t()} | {:error, Ecto.Changeset.t()}

Deletes given changeset and stores the changes at that time in the cellar.

  • options: EctoCellar.options()
  • delete_opts: options for Ecto.Repo.update/2
Link to this function

insert_store(changeset, opts \\ [], insert_opts \\ [])

Specs

insert_store(Ecto.Schema.t() | Ecto.Changeset.t(), options(), Keyword.t()) ::
  {:ok, Ecto.Schema.t()} | {:error, Ecto.Changeset.t()}

Inserts given model(or changeset) and stores the changes at that time in the cellar.

  • options: EctoCellar.options()
  • insert_opts: options for Ecto.Repo.insert/2
Link to this function

one(model, timestamp, opts \\ [])

Specs

Returns a specific version of model from the cellar.

Link to this function

store(model, opts \\ [])

Specs

store(Ecto.Schema.t() | Ecto.Changeset.t(), options()) ::
  {:ok, Ecto.Schema.t()} | {:error, term()}

Stores the changes at that time in the cellar.

Link to this function

store!(model, opts \\ [])

Specs

Like store/2, except that if the record is invalid, raises an exception.

Link to this function

update_store(changeset, opts \\ [], update_opts \\ [])

Specs

update_store(Ecto.Changeset.t(), options(), Keyword.t()) ::
  {:ok, Ecto.Schema.t()} | {:error, Ecto.Changeset.t()}

Updates given changeset and stores the changes at that time in the cellar.

  • options: EctoCellar.options()
  • update_opts: options for Ecto.Repo.update/2
Link to this function

upsert_store(changeset, opts \\ [], insert_or_update_opts \\ [])

Specs

upsert_store(Ecto.Changeset.t(), options(), Keyword.t()) ::
  {:ok, Ecto.Schema.t()} | {:error, Ecto.Changeset.t()}

Inserts or updates given changeset and stores the changes at that time in the cellar.

  • options: EctoCellar.options()
  • insert_or_update_opts: options for Ecto.Repo.insert_or_update/2