postgres

package
v0.1.0 Latest Latest
Warning

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

Go to latest
Published: Jun 7, 2026 License: MIT Imports: 7 Imported by: 0

Documentation

Overview

Package postgres exposes the typed funnel for PostgreSQL-backed accesscore wiring. A single NewBundle call derives the UserRepository, RoleRepository, SetupLock and TxRunner from the same (pool, txMgr, clock) triple — the Bundle struct is sealed (private fields, exported only via accessor methods consumed by cells/accesscore.WithPGBundle) so composition roots cannot accidentally pair primitives from different pools or substitute a non-PG SetupLock.

See cells/accesscore/mem.Bundle godoc for the upstream-Hard / downstream-Hard analysis; this package follows the same pattern.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Bundle

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

Bundle is the PG-backed (UserRepository, RoleRepository, SetupLock, TxRunner) quadruple. Fields are unexported; cells/accesscore.WithPGBundle consumes the values via the exported accessor methods.

func NewBundle

func NewBundle(pool *pgxpool.Pool, txMgr persistence.TxRunner, clk clock.Clock) (Bundle, error)

NewBundle constructs a PG-backed accesscore bundle. All four wired primitives originate from the same (pool, txMgr, clk) triple — the pg_advisory_xact_lock acquired by SetupLock and the transactions run by TxRunner share the same database session.

Fails fast on nil pool / typed-nil txMgr / typed-nil clk.

func (Bundle) RoleRepository

func (b Bundle) RoleRepository() ports.RoleRepository

RoleRepository returns the bundle-paired PG RoleRepository.

func (Bundle) SetupLock

func (b Bundle) SetupLock() ports.SetupLockAcquirer

SetupLock returns the bundle-paired PG advisory lock.

func (Bundle) TxRunner

func (b Bundle) TxRunner() persistence.CellTxManager

TxRunner returns the bundle-paired CellTxManager wrapping the same txMgr.

func (Bundle) UserRepository

func (b Bundle) UserRepository() ports.UserRepository

UserRepository returns the bundle-paired PG UserRepository.

Jump to

Keyboard shortcuts

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