postgres

package
v1.9.0 Latest Latest
Warning

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

Go to latest
Published: Nov 3, 2026 License: MIT Imports: 18 Imported by: 0

Documentation

Overview

Package postgres provides a PostgreSQL implementation of store.Store using grove ORM.

Index

Constants

This section is empty.

Variables

View Source
var Migrations = migrate.NewGroup("keysmith")

Migrations is the grove migration group for the Keysmith Postgres store. Each migration lives in a file of its own, named <14 digit version>_<name>.go, and registers itself with Migrations.Add.

Store.Migrate runs the group through grove's orchestrator, which takes the migration lock first, so several processes can start against one database at once. A host that runs its migrations centrally can register this group with its own orchestrator instead and turn Store.Migrate off (the Forge extension's WithDisableMigrate).

The versions and names match the ones keysmith has always recorded in grove_migrations, so a database that already applied them skips them.

Functions

This section is empty.

Types

type Store

type Store struct {
	// contains filtered or unexported fields
}

Store is the PostgreSQL-backed store implementation using grove ORM.

func New

func New(db *pgdriver.PgDB) *Store

New creates a new PostgreSQL store with the given grove pgdriver instance.

func NewFromDSN

func NewFromDSN(ctx context.Context, dsn string) (*Store, error)

NewFromDSN creates a new PostgreSQL store by connecting to the given DSN.

func (*Store) Close

func (s *Store) Close() error

Close releases the connection pool.

func (*Store) Keys

func (s *Store) Keys() key.Store

Keys returns the key store.

func (*Store) Migrate

func (s *Store) Migrate(ctx context.Context) error

Migrate applies the pending migrations in Migrations through grove's orchestrator. It holds grove's migration lock (a Postgres advisory lock) while it runs, so nodes that start together against one database take turns, and every one after the first finds nothing left to apply.

func (*Store) Ping

func (s *Store) Ping(ctx context.Context) error

Ping checks database connectivity.

func (*Store) Policies

func (s *Store) Policies() policy.Store

Policies returns the policy store.

func (*Store) Rotations

func (s *Store) Rotations() rotation.Store

Rotations returns the rotation store.

func (*Store) Scopes

func (s *Store) Scopes() scope.Store

Scopes returns the scope store.

func (*Store) Usages

func (s *Store) Usages() usage.Store

Usages returns the usage store.

Jump to

Keyboard shortcuts

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