# `Beancount.Schemas.Transaction`
[🔗](https://github.com/thanos/beancount_ex/blob/v0.6.0/lib/beancount/schemas/transaction.ex#L1)

Persisted `transaction` directive (table `beancount_transactions`).

Storage-layer counterpart of `Beancount.Directives.Transaction`. Postings are
stored inline as embedded `Beancount.Schemas.Posting` rows (no separate
table).

## Fields

  * `date` - the day the transaction is booked.
  * `flag` - transaction flag, e.g. `"*"` (completed) or `"!"` (pending).
  * `payee` - optional payee string, or `nil`.
  * `narration` - free-text description of the transaction.
  * `tags` - list of tag names without `#`, e.g. `["trip-athens"]`.
  * `links` - list of link names without `^`, e.g. `["invoice-042"]`.
  * `metadata` - arbitrary key/value map.
  * `postings` - embedded list of `Beancount.Schemas.Posting`.
  * `file_order` - zero-based position of the directive in the source.

## Example

    %Beancount.Schemas.Transaction{
      date: ~D[2026-01-31],
      flag: "*",
      payee: "Employer",
      narration: "Salary",
      tags: [],
      links: [],
      metadata: %{},
      file_order: 3,
      postings: [
        %Beancount.Schemas.Posting{account: "Assets:Bank", amount: Decimal.new("5000"), currency: "USD"},
        %Beancount.Schemas.Posting{account: "Income:Salary", amount: Decimal.new("-5000"), currency: "USD"}
      ]
    }

# `t`

```elixir
@type t() :: %Beancount.Schemas.Transaction{
  __meta__: term(),
  date: term(),
  file_order: term(),
  flag: term(),
  id: term(),
  inserted_at: term(),
  links: term(),
  metadata: term(),
  narration: term(),
  payee: term(),
  postings: term(),
  tags: term(),
  updated_at: term()
}
```

---

*Consult [api-reference.md](api-reference.md) for complete listing*
