Zerobook.Entry (zerobook v0.1.0)

Copy Markdown

A single line of a double-entry Zerobook.Transaction.

An entry moves amount units (integers only — use cents, attos, etc.) in currency to or from the ledger account named account.

  • positive amount debits the account (money flows in)
  • negative amount credits the account (money flows out)

The sign convention is arbitrary but must be consistent across the ledger; what matters for correctness is that every transaction sums to zero per currency.

Summary

Types

t()

@type t() :: %Zerobook.Entry{
  account: String.t(),
  amount: integer(),
  currency: String.t(),
  description: String.t() | nil
}

Functions

new(account, amount, currency, description \\ nil)

Builds an entry.

Examples

iex> Zerobook.Entry.new("1000.cash", 1_000, "BRL", "opening")
%Zerobook.Entry{account: "1000.cash", amount: 1000, currency: "BRL", description: "opening"}