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

Link to this function

build_version(struct, opts)

View Source
@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 - If true, records will marked as deleted.
  • :change - For updates, an Ecto.Changeset.t/0 should be provided to inform which records were inserted vs updated vs deleted.
Link to this function

deleted_versions(changeset \\ nil, opts)

View Source
@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.

@spec normalize_block(Macro.t()) :: Macro.t()

Wrap a line of AST in a block if it isn't already wrapped.