Beancount.Schemas.PriceAnnotation (beancount_ex v0.6.0)

Copy Markdown View Source

Persisted posting price annotation (embedded schema).

Storage-layer counterpart of a Beancount.Directives.Posting :price map (@/@@). Embedded inside Beancount.Schemas.Posting via embeds_one/3; it has no table of its own.

Storing the price as a typed embedded schema (rather than a bare map) keeps amount a Decimal.t() across a database round-trip, so rendering the loaded directive produces byte-identical Beancount text.

Fields

  • amount - price quantity as Decimal.t().
  • currency - commodity of amount.
  • type - "unit" for @ (per-unit) or "total" for @@ (total) price.

Example

%Beancount.Schemas.PriceAnnotation{
  amount: Decimal.new("197.90"),
  currency: "USD",
  type: "unit"
}

Summary

Types

t()

@type t() :: %Beancount.Schemas.PriceAnnotation{
  amount: term(),
  currency: term(),
  id: term(),
  type: term()
}