store

package
v0.1.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jul 16, 2026 License: Apache-2.0 Imports: 6 Imported by: 0

Documentation

Overview

Package store owns the Postgres schema. It embeds the SQL migrations and applies them on Open, so every binary converges the database to the current schema at startup.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Migrate

func Migrate(ctx context.Context, pool *pgxpool.Pool) error

Migrate applies any migrations not yet recorded in schema_migrations, in filename order, all inside one transaction: either the database reaches the current schema or it is left untouched. (Consequence: a migration can never use statements Postgres forbids inside a transaction block, e.g. CREATE INDEX CONCURRENTLY — extend the migrator if that day comes.)

func Open

func Open(ctx context.Context, dsn string) (*pgxpool.Pool, error)

Open connects to the database at dsn, verifies the connection, and applies any pending migrations. The returned pool is ready for use; the caller closes it at process exit.

Types

This section is empty.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL