No description
Find a file
Repository files (latest commit first)
Filename Latest commit message Latest commit date
hum3 bea940607d Migrate forge references from codeberg.org to git.bytestone.uk
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>
2026-08-08 16:49:57 +02:00
.claude Adding tbls format 2026-03-06 11:45:59 +00:00
.vscode Starting to convert to and from plain text files 2026-03-03 11:56:18 +00:00
api Migrate forge references from codeberg.org to git.bytestone.uk 2026-08-08 16:49:57 +02:00
benchmarks refactor to goluca syntax 2026-03-16 00:22:22 +00:00
cmd Migrate forge references from codeberg.org to git.bytestone.uk 2026-08-08 16:49:57 +02:00
docs Reorganising schema 2026-03-22 20:10:30 +00:00
internal/benchutil Updating benchmark 2026-03-23 23:57:47 +00:00
research Adding movement codes 2026-03-16 14:48:41 +00:00
.gitignore Merging lint changes 2026-03-23 23:59:27 +00:00
.tbls.yml Reorganising schema 2026-03-22 20:10:30 +00:00
balance.go Fixing lint errors 2026-03-23 23:57:06 +00:00
balance_test.go Migrate forge references from codeberg.org to git.bytestone.uk 2026-08-08 16:49:57 +02:00
bench-api comparing numbers and tidying 2026-03-07 11:54:25 +00:00
bench-balance-types comparing numbers and tidying 2026-03-07 11:54:25 +00:00
bench-compound-movements comparing numbers and tidying 2026-03-07 11:54:25 +00:00
bench-scv comparing numbers and tidying 2026-03-07 11:54:25 +00:00
benchmark_test.go Migrate forge references from codeberg.org to git.bytestone.uk 2026-08-08 16:49:57 +02:00
CHANGELOG.md Update CHANGELOG for v0.2.30 2026-05-06 08:26:40 +01:00
CLAUDE.md using typed Account 2026-03-14 10:22:07 +00:00
datetime.go Fixing lint errors 2026-03-23 23:57:06 +00:00
datetime_test.go refactor to goluca syntax 2026-03-16 00:23:24 +00:00
db.go Update README.md for v0.2.26 2026-03-27 11:18:25 +00:00
db_test.go Migrate forge references from codeberg.org to git.bytestone.uk 2026-08-08 16:49:57 +02:00
decimal.go Updating benchmark 2026-03-23 23:57:47 +00:00
decimal_test.go using typed Account 2026-03-14 10:22:07 +00:00
diff.go refactor to goluca syntax 2026-03-16 00:22:22 +00:00
directives_db.go Fixing lint errors 2026-03-23 23:57:06 +00:00
events.go Fixing lint errors 2026-03-23 23:57:06 +00:00
export.go Fixing lint errors 2026-03-23 23:57:06 +00:00
export_test.go Migrate forge references from codeberg.org to git.bytestone.uk 2026-08-08 16:49:57 +02:00
go-luca.code-workspace Changing to number 2026-03-14 10:23:19 +00:00
go.mod Migrate forge references from codeberg.org to git.bytestone.uk 2026-08-08 16:49:57 +02:00
go.sum Migrate forge references from codeberg.org to git.bytestone.uk 2026-08-08 16:49:57 +02:00
goluca.go Migrate forge references from codeberg.org to git.bytestone.uk 2026-08-08 16:49:57 +02:00
goluca_test.go refactor to goluca syntax 2026-03-16 00:23:24 +00:00
import.go Reorganising schema 2026-03-22 20:10:30 +00:00
import_test.go Migrate forge references from codeberg.org to git.bytestone.uk 2026-08-08 16:49:57 +02:00
luca-docs Fixing lint errors 2026-03-23 23:57:06 +00:00
luca.go Move interest computation to gobank-products, extract DB helpers to gobank-db 2026-03-27 09:49:06 +00:00
luca_test.go refactor to goluca syntax 2026-03-16 00:22:22 +00:00
mem_ledger.go Move interest computation to gobank-products, extract DB helpers to gobank-db 2026-03-27 09:49:06 +00:00
mem_ledger_test.go Move interest computation to gobank-products, extract DB helpers to gobank-db 2026-03-27 09:49:06 +00:00
README.md Migrate forge references from codeberg.org to git.bytestone.uk 2026-08-08 16:49:57 +02:00
ROADMAP.md comparing numbers and tidying 2026-03-07 11:54:25 +00:00
roundtrip_test.go Migrate forge references from codeberg.org to git.bytestone.uk 2026-08-08 16:49:57 +02:00
schema.go Migrate forge references from codeberg.org to git.bytestone.uk 2026-08-08 16:49:57 +02:00
schema_test.go Migrate forge references from codeberg.org to git.bytestone.uk 2026-08-08 16:49:57 +02:00
search.go Fixing lint errors 2026-03-23 23:57:06 +00:00
sql_ledger.go Move interest computation to gobank-products, extract DB helpers to gobank-db 2026-03-27 09:49:06 +00:00
task-plus.yml updating taskfile 2026-03-13 01:09:19 +00:00
Taskfile.yml Updating git workflow 2026-03-23 23:42:07 +00:00
TEXT_SYNTAX.md Fleshing out API interface and creating ledger documentation 2026-03-04 11:09:10 +00:00
timeseries.go Fixing lint errors 2026-03-23 23:57:06 +00:00

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 int64 in 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 backendsSQLLedger (pglike/SQLite or PostgreSQL), MemLedger (in-memory), or HTTP/JSON API client. All implement the Ledger interface.

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

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