database

package
v0.3.4 Latest Latest
Warning

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

Go to latest
Published: Oct 10, 2026 License: MIT Imports: 5 Imported by: 0

Documentation

Overview

Package database is the database client tier: it selects a SQL connection-pool backend — PostgreSQL today (postgres/) — by Kind and returns the interfaces.DatabasePool contract, so switching database engines is a config change, not a caller edit. The contract lives in core (interfaces.DatabasePool); the backend implements it; this is the factory, mirroring the cache/storage NewFromConfig shape.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func NewFromConfig

func NewFromConfig(cfg Config) (interfaces.DatabasePool, error)

NewFromConfig builds the database pool selected by cfg.Kind: the PostgreSQL pool (KindPostgres) today. It is the app-wiring entrypoint mirroring the cache/storage NewFromConfig factory; the returned pool is not opened until Start.

Types

type Config

type Config struct {
	// Database holds the connection settings (DSN, pool sizing) for the backend.
	Database *infra.DatabaseConfig

	// Kind selects the backend. The zero value is KindPostgres.
	Kind Kind
}

Config selects and configures the database backend.

type Kind

type Kind int

Kind selects the database backend.

const (
	// KindPostgres uses a PostgreSQL connection pool via the pgx stdlib driver
	// (production and dev).
	KindPostgres Kind = iota
)

func (Kind) String

func (k Kind) String() string

String returns the string form of Kind.

Directories

Path Synopsis
Package postgres is the PostgreSQL backend of the database client tier: a lifecycle-managed *sql.DB pool (Client) plus ORM-independent pool utilities — a boot-time reachability probe (Ping) and a Prometheus pool-stats collector.
Package postgres is the PostgreSQL backend of the database client tier: a lifecycle-managed *sql.DB pool (Client) plus ORM-independent pool utilities — a boot-time reachability probe (Ping) and a Prometheus pool-stats collector.

Jump to

Keyboard shortcuts

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