View Source Versioned.Multi (Versioned v0.4.0)
Tools for operating on versioned records.
Link to this section Summary
Functions
To be invoked after Repo.transaction/1
. If successful, the id of "_version"
will be attached to the :version_id
field of of the returned record.
Returns an Ecto.Multi with all steps necessary to delete a versioned record.
Returns an Ecto.Multi with all steps necessary to insert a versioned record.
See Ecto.Multi.new/0
.
Returns an Ecto.Multi with all steps necessary to update a versioned record.
Link to this section Functions
To be invoked after Repo.transaction/1
. If successful, the id of "_version"
will be attached to the :version_id
field of of the returned record.
@spec delete(t(), name(), schema() | cs() | (changes() -> cs() | schema()), keyword()) :: t()
Returns an Ecto.Multi with all steps necessary to delete a versioned record.
An Ecto.Multi is returned which first updates the record itself, inserts a new version into the versions table and finally deletes associations as needed.
If name
is "puppy"
, the returned parts will be:
:puppy
- The updated record itself."puppy_version"
- The newly inserted version record (is_deleted=TRUE).
@spec insert(t(), name(), cs() | schema() | (changes() -> cs() | schema()), keyword()) :: t()
Returns an Ecto.Multi with all steps necessary to insert a versioned record.
If name
is :puppy
, the returned parts will be:
:puppy
- The inserted record itself."puppy_version"
- The inserted version record.
See Ecto.Multi.new/0
.
@spec update(t(), name(), cs() | (changes() -> cs()), keyword()) :: t()
Returns an Ecto.Multi with all steps necessary to update a versioned record.
An Ecto.Multi is returned which first updates the record itself, inserts a new version into the versions table and finally deletes associations as needed.
If name
is "puppy"
, the returned parts will be:
:puppy
- The updated record itself."puppy_version"
- The newly inserted version record."puppy_deletes"
- List of association version records which were deleted."puppy_full"
- Internal use only. A tuple with the updated record and opts including the changeset.