View Source Versioned.Helpers (Versioned v0.4.0)
Tools shared between modules. (For internal use.)
Link to this section Summary
Functions
Create a version_mod
struct to insert from a new instance of the record.
Recursively crawl changeset and compile a list of version structs with is_deleted set to true.
Wrap a line of AST in a block if it isn't already wrapped.
Link to this section Functions
@spec build_version( Ecto.Schema.t(), keyword() ) :: Ecto.Changeset.t() | nil
Create a version_mod
struct to insert from a new instance of the record.
options
Options
:deleted
- Iftrue
, records will marked as deleted.:change
- For updates, anEcto.Changeset.t/0
should be provided to inform which records were inserted vs updated vs deleted.
@spec deleted_versions( Ecto.Changeset.t() | nil, keyword() ) :: [Ecto.Schema.t()]
Recursively crawl changeset and compile a list of version structs with is_deleted set to true.
The changeset to operate on is passed in either as the first parameter or
under the :change
key in opts
.
Wrap a line of AST in a block if it isn't already wrapped.