postgres

package
v0.0.0-...-1779528 Latest Latest
Warning

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

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

Documentation

Overview

Package postgres wires PostgreSQL-backed repositories for configcore.

This package is intentionally outside cells/configcore's root package so the Cell's exported API stays port-oriented while composition roots can still choose the concrete storage adapter.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func WithPool

func WithPool(pool *pgxpool.Pool, clk clock.Clock, opts ...Option) (configcore.Option, error)

WithPool injects PostgreSQL-backed config and flag repositories into configcore using the provided pool.

clk must be non-nil; pass clock.Real() at the composition root. The pool lifecycle, schema guard, TxManager, outbox writer, and relay remain the composition root's responsibility. This option only adapts the pool into configcore's cell-local repository ports.

Returns ErrCellInvalidConfig when pool is nil so wiring mistakes fail before ConfigCore is constructed with unusable repositories.

WithLogger configures repository logs only. Call configcore.WithLogger separately when the cell itself should use the same logger.

Types

type Option

type Option func(*settings)

Option configures PostgreSQL repository wiring for configcore.

func WithLogger

func WithLogger(l *slog.Logger) Option

WithLogger sets the logger used by the config repository. Nil means slog.Default(), matching the repository constructor's default.

func WithOnStaleCipher

func WithOnStaleCipher(fn func(key, storedKeyID, currentKeyID string)) Option

WithOnStaleCipher sets the callback invoked when a stale encrypted value is read. Composition roots commonly use this to increment an observability counter without exposing Prometheus types through cells/configcore.

func WithValueTransformer

func WithValueTransformer(t kcrypto.ValueTransformer) Option

WithValueTransformer sets the transformer used by the config repository to encrypt/decrypt sensitive values at the repository boundary.

Jump to

Keyboard shortcuts

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