No description
- Go 100%
| Filename | Latest commit message | Latest commit date |
|---|---|---|
Module path and self-referencing URLs now point at the new Forgejo instance following the move off Codeberg. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com> |
||
| .claude | ||
| .vscode | ||
| api | ||
| benchmarks | ||
| cmd | ||
| docs | ||
| internal/benchutil | ||
| research | ||
| .gitignore | ||
| .tbls.yml | ||
| balance.go | ||
| balance_test.go | ||
| bench-api | ||
| bench-balance-types | ||
| bench-compound-movements | ||
| bench-scv | ||
| benchmark_test.go | ||
| CHANGELOG.md | ||
| CLAUDE.md | ||
| datetime.go | ||
| datetime_test.go | ||
| db.go | ||
| db_test.go | ||
| decimal.go | ||
| decimal_test.go | ||
| diff.go | ||
| directives_db.go | ||
| events.go | ||
| export.go | ||
| export_test.go | ||
| go-luca.code-workspace | ||
| go.mod | ||
| go.sum | ||
| goluca.go | ||
| goluca_test.go | ||
| import.go | ||
| import_test.go | ||
| luca-docs | ||
| luca.go | ||
| luca_test.go | ||
| mem_ledger.go | ||
| mem_ledger_test.go | ||
| README.md | ||
| ROADMAP.md | ||
| roundtrip_test.go | ||
| schema.go | ||
| schema_test.go | ||
| search.go | ||
| sql_ledger.go | ||
| task-plus.yml | ||
| Taskfile.yml | ||
| TEXT_SYNTAX.md | ||
| timeseries.go | ||
go-luca
A Go library for movement-based double-entry bookkeeping, inspired by Luca Pacioli and TigerBeetle.
Overview
go-luca treats cash movements as the fundamental accounting record, not posting legs. This follows the principle described at bytestone.uk/afp/movements. Movements are grouped into batches that occur at a single point in time, within transactions that span a period.
Key design choices:
- Amounts are
int64in smallest currency unit (e.g. pence), with an exponent per account. No floating-point anywhere in core accounting. - Same-exponent rule per ledger — movements only between accounts with matching exponents. Cross-exponent transfers are explicit currency conversions.
- Bitemporal — each event has a value time and an optional knowledge time.
- Pluggable backends —
SQLLedger(pglike/SQLite or PostgreSQL),MemLedger(in-memory), or HTTP/JSON API client. All implement theLedgerinterface.
Architecture
Ledger (interface)
├── SQLLedger — database/sql backend (pglike or postgres)
├── MemLedger — pure Go in-memory
└── api.Client — HTTP/JSON client (implements Ledger)
Account hierarchy
Accounts follow a colon-separated path: Type:Product:AccountID:Address. Balances can be queried at any level of the hierarchy.
Interest
Daily interest accrual using actual/365. See research/interest/ for the design rationale covering AER, day-count conventions, rounding strategies, and the discrete-interest formula.
Getting started
import "git.bytestone.uk/hum3/go-luca"
db, _ := sql.Open("pglike", "file:ledger.db")
ledger, _ := luca.NewSQLLedger(db)
acct, _ := ledger.CreateAccount("Asset:Bank:Current", "GBP", -2, 0)
See cmd/example/main.go for a working demo.
Project structure
| Path | Description |
|---|---|
luca.go |
Core types: Account, Movement, Ledger interface |
db.go |
SQLLedger CRUD + same-exponent validation |
balance.go |
Balance queries (point-in-time, by path, daily) |
interest.go |
Daily interest engine |
decimal.go |
int64/decimal conversion helpers |
schema.go |
DDL schema creation |
api/ |
HTTP/JSON server and client |
cmd/ |
Binaries (server, example, benchmarks) |
benchmarks/ |
Benchmark results and analysis |
research/ |
Design research (numeric formats, interest) |
References
Links
| Documentation | https://h3-go-luca.statichost.page/ |
| Source (Codeberg) | https://git.bytestone.uk/hum3/go-luca |
| Mirror (GitHub) | https://github.com/drummonds/go-luca |
| Docs repo | https://git.bytestone.uk/hum3/go-luca-docs |