Chronicle. Version
(chronicle v0.1.1)
Copy Markdown
One immutable, signed version of an Ecto record.
A version holds only what describes the version itself: where it sits in the record's history, what kind of change it was, and whether the record can be reconstructed from it.
%Chronicle.Version{
version: 3,
operation: :update,
schema: MyApp.Account,
record: %MyApp.Account{},
restorable?: true
}version is the record-local, one-based position in committed ledger order.
A deleted version is a tombstone: operation is :delete and record is
nil.
Everything describing the event — actor, subject, changes, timestamp,
correlation id, group id, metadata — lives on event, and only there. No
value appears in two places. operation and schema are typed readings of
event.action and event.subject, not copies of them:
version.event.actor
version.event.changes
version.event.occurred_at
version.event.subject["id"]
Summary
Functions
Returns the field transitions recorded for a version.
Returns the stored snapshot for a version.
Types
@type t() :: %Chronicle.Version{ event: Chronicle.Event.t(), missing_fields: [atom()], operation: :insert | :update | :delete, reconstruction_error: term() | nil, record: struct() | nil, restorable?: boolean(), schema: module(), version: pos_integer() }