Expand description
Pure, DB-free logical→physical transaction lowering.
This module is the single source of truth for the from→to FX math used by every client surface (CLI, TUI, web) and the upcoming B2b RPC native. No database calls, no async.
Structs§
- Logical
Split - A from→to exchange;
to_amountis required ifffrom_commodity != to_commodity. - Physical
Split - One physical ledger entry.
- Price
Row - One price-table row linking two physical splits.
- Raised
Row - One recovered from→to row.
- RowTags
- The split tags of a from→to row:
sharedgo on both legs,fromandtoon that leg only. - Split
Fault - A lowering failure;
fieldisNonewhen the whole row is at fault.
Enums§
- Split
Field - The input a lowering rule rejected.
Constants§
- STALE_
REVISION - The error text of an update whose expected revision no longer matches.
Functions§
- ensure_
single_ line_ names - The shared forms keep tag names and values in single-line cells and descriptions in multiline ones; only a name or value loses a line break.
- form_
refusal Okwhen the stored transaction round-trips through the logical form, else the reason it does not: reconciliation or lot data, an ambiguous pairing, an exchange rate off its splits, two notes, two values of one tag name, or a line break in a tag name or value.- has_
line_ break - Whether
textholds a line break a single-line cell would lose. - is_note
- Whether
tagis the note: tags are stored under trimmed names, so a paddednoteis the note too. - is_
note_ name - Whether a stored or typed tag name stands for the note.
- lower_
logical_ split - Lower one logical split to two physical splits and an optional price row.
- lower_
logical_ split_ located - Lower one logical split to two physical splits and an optional price row, naming the input a rejection comes from.
- lower_
logical_ transaction - Lower a non-empty slice of logical splits into physical splits and price rows.
- note_
value - The value of the note among a listing’s tags, which are keyed by stored name.
- pick_
note - The note among
tags: the greatest by byte order of (name, value) should a legacy padded name leave several, whatever the ordertagscome in. - raise_
transaction - Recover from→to rows in input order of their FROM splits, or fail when the pairing is not provable.
- row_
tags - The row’s tags, each part sorted by name.
- stored_
revision revisionof the stored transaction tags as loaded, the note among them; the last note intagswins, asGetTransactionDetailshows it.