class

Finfry::Database

Inherits JSON::Serializable < Reference < Object

The full persisted state: an id counter, all transactions, per-account monthly budget limits (cents), the declared chart of accounts, the unknown-account policy, and the undo journal.

Constructors

new

Brand-new ledger only — seeds the starter chart. from_json does not call this, so deserialized ledgers keep whatever chart they had (or none).

Source
new(*, __pull_for_json_serializable pull : JSON::PullParser)
Source

Instance methods

account_meta

Free-form per-account metadata (account => key => value), e.g. a credit card's apr/limit/due-day. Visible to the AI; secrets are a later feature.

Source
account_meta=(account_meta : Hash(String, Hash(String, String)))

Free-form per-account metadata (account => key => value), e.g. a credit card's apr/limit/due-day. Visible to the AI; secrets are a later feature.

Source
account_policy

"strict" | "guard" | "off"

Source
account_policy=(account_policy : String)

"strict" | "guard" | "off"

Source
accounts

Explicitly declared accounts (the chart). Empty by default so existing ledgers loaded via from_json aren't reseeded.

Source
accounts=(accounts : Array(String))

Explicitly declared accounts (the chart). Empty by default so existing ledgers loaded via from_json aren't reseeded.

Source
budgets
Source
budgets=(budgets : Hash(String, Int64))
Source
changesets

Undo journal — one entry per mutating operation, newest last.

Source
changesets=(changesets : Array(Changeset))

Undo journal — one entry per mutating operation, newest last.

Source
cleared

Reconciliation, two-tier. cleared is the staged tier — transactions toggled cleared during a session, still editable (account => [ids]). reconciled is the committed tier — transactions locked in by a finished, statement-balanced reconciliation; they drop off the working list.

Source
cleared=(cleared : Hash(String, Array(Int32)))

Reconciliation, two-tier. cleared is the staged tier — transactions toggled cleared during a session, still editable (account => [ids]). reconciled is the committed tier — transactions locked in by a finished, statement-balanced reconciliation; they drop off the working list.

Source
due_entries

The due queue (generated occurrences awaiting review) + its id counter.

Source
due_entries=(due_entries : Array(DueEntry))

The due queue (generated occurrences awaiting review) + its id counter.

Source
next_changeset_id
Source
next_changeset_id=(next_changeset_id : Int32)
Source
next_due_id
Source
next_due_id=(next_due_id : Int32)
Source
next_id
Source
next_id=(next_id : Int32)
Source
next_recurring_id
Source
next_recurring_id=(next_recurring_id : Int32)
Source
reconciled
Source
reconciled=(reconciled : Hash(String, Array(Int32)))
Source
reconciliations

Audit trail of finalized reconciliations, newest last.

Source
reconciliations=(reconciliations : Array(Reconciliation))

Audit trail of finalized reconciliations, newest last.

Source
recurring

Recurring rules + their id counter.

Source
recurring=(recurring : Array(RecurringRule))

Recurring rules + their id counter.

Source
redo_snapshot

The last change removed by undo, available for redo until the next mutation invalidates it.

Source
redo_snapshot=(redo_snapshot : RedoSnapshot | Nil)

The last change removed by undo, available for redo until the next mutation invalidates it.

Source
transactions
Source
transactions=(transactions : Array(Transaction))
Source