EctoCellar (EctoCellar v0.1.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. For a model whose primary_key is other than id, specify id_type and use it.

Link to this section Summary

Functions

Returns all versions of model from 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.

Link to this section Functions

Link to this function

all(model, id_type \\ :id)

Specs

all(
  struct(),
  any()
) :: [struct()]

Returns all versions of model from the cellar.

Link to this function

one(model, timestamp, id_type \\ :id)

Specs

one(struct(), NaiveDateTime.t(), any()) :: struct()

Returns a specific version of model from the cellar.

Link to this function

store(model, id_type \\ :id)

Specs

store(
  struct(),
  atom()
) :: {:ok, struct()} | {:error, struct()}

Stores the changes at that time in the cellar.

Link to this function

store!(model, id_type \\ :id)

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