gobank-db

Core database abstraction for gobank — shared schema, multi-user base, built on go-postgres.

Part of the gobank family of libraries.

Overview

gobank-db provides:

  • Shared Schema — common database schema used across gobank services
  • Multi-User Base — abstracts DB technology so multiple services/users share one database
  • Migration Support — schema versioning and migration management
  • Connection Management — pooled connections with go-postgres (pglike for dev, Postgres/CockroachDB for prod)

Testing

Tests run against pglike (in-memory SQLite with PostgreSQL syntax translation) by default — no database server needed:

task test

To run against a real PostgreSQL instance, set GOBANK_TEST_DSN:

createdb gobank_test
GOBANK_TEST_DSN="postgres:///gobank_test?host=/var/run/postgresql" task test
dropdb gobank_test

Both backends exercise the same test suite and schema.

Status

Early development. See issues for planned work.