View Source Carbonite.Transaction (Carbonite v0.12.1)

A Carbonite.Transaction is the binding link between change records of tables.

As such, it contains a set of optional metadata that describes the transaction.

Summary

Functions

Builds a changeset for a new Carbonite.Transaction.

Returns the currently stored metadata.

Stores a piece of metadata in the process dictionary.

Types

@type id() :: non_neg_integer()
@type meta() :: map()
@type t() :: %Carbonite.Transaction{
  __meta__: term(),
  changes: Ecto.Association.NotLoaded.t() | [Carbonite.Change.t()],
  id: id(),
  inserted_at: DateTime.t(),
  meta: meta(),
  xact_id: non_neg_integer()
}

Functions

Link to this function

changeset(params \\ %{})

View Source (since 0.2.0)
@spec changeset(params :: map()) :: Ecto.Changeset.t()

Builds a changeset for a new Carbonite.Transaction.

The :meta map from the params will be merged with the metadata currently stored in the process dictionary.

Link to this function

current_meta()

View Source (since 0.2.0)
@spec current_meta() :: meta()

Returns the currently stored metadata.

Link to this function

put_meta(key, value)

View Source (since 0.2.0)
@spec put_meta(key :: any(), value :: any()) :: meta()

Stores a piece of metadata in the process dictionary.

This can be useful in situations where you want to record a value at a system boundary (say, the user's account_id) without having to pass it through to the database transaction.

Returns the currently stored metadata.