DoubleEntryLedger.JournalEventCommandLink (double_entry_ledger v0.1.0)

View Source

Join schema linking events and transactions in the Double Entry Ledger.

This schema records the relationship between events (business intents) and transactions (ledger entries) to provide a complete audit trail. Each link represents that a specific event was involved in creating or updating a transaction.

Fields

  • :command_id - References the associated event.
  • :transaction_id - References the associated transaction.
  • :inserted_at - Timestamp when the link was created.
  • :updated_at - Timestamp when the link was last updated.

Usage

Use this schema to query all events that affected a transaction, or all transactions that were affected by a specific event. This enables safe pruning of processing state while preserving the full business and audit history.

Summary

Types

t()

@type t() :: %DoubleEntryLedger.JournalEventCommandLink{
  __meta__: term(),
  command: DoubleEntryLedger.Command.t() | Ecto.Association.NotLoaded.t(),
  command_id: Ecto.UUID.t() | nil,
  id: Ecto.UUID.t() | nil,
  inserted_at: DateTime.t() | nil,
  journal_event: DoubleEntryLedger.Command.t() | Ecto.Association.NotLoaded.t(),
  journal_event_id: Ecto.UUID.t() | nil,
  updated_at: DateTime.t() | nil
}

Functions

changeset(journal_event_command_link, attrs)

@spec changeset(t(), map()) :: Ecto.Changeset.t()