Logistiki.Projections.Balance (logistiki v0.1.0)

Copy Markdown View Source

A derived balance for an account (or aggregation of accounts).

Balances are never authoritative stored state. They are projections over immutable postings. net is signed: positive for a debit balance, negative for a credit balance.

Summary

Types

t()

The struct type. See the module documentation for field details and examples.

Functions

Builds a balance from a row of {debit_total, credit_total, count} for currency.

True when the balance is non-zero.

Types

t()

@type t() :: %Logistiki.Projections.Balance{
  account_code: String.t() | nil,
  account_id: term() | nil,
  credit_total: Decimal.t(),
  currency: String.t(),
  debit_total: Decimal.t(),
  net: Decimal.t(),
  posting_count: non_neg_integer()
}

The struct type. See the module documentation for field details and examples.

Functions

build(account_code, currency, debit_total, credit_total, count)

(since 0.1.0)

Builds a balance from a row of {debit_total, credit_total, count} for currency.

nonzero?(balance)

(since 0.1.0)

True when the balance is non-zero.