database

package
v0.0.40 Latest Latest
Warning

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

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

Documentation

Overview

Package database builds the SQL connection pool from config: PostgreSQL (postgres/) today, behind interfaces.DatabasePool, so switching engines is a config change. It ships no stub: a pool hands its caller a *sql.DB, which nothing zero-I/O can stand in for, so an empty kind selects PostgreSQL.

Index

Constants

View Source
const KindPostgres client.Kind = "postgres"

KindPostgres pools connections to PostgreSQL (the default).

Variables

This section is empty.

Functions

func NewFromConfig

func NewFromConfig(
	ctx context.Context,
	cfg Config,
	deps Deps,
) (interfaces.DatabasePool, error)

NewFromConfig builds the pool cfg.Kind selects, without I/O (it connects on Start). An unknown kind is CodeInvalidInput.

Types

type Config

type Config struct {
	// Kind selects the backend; empty means KindPostgres.
	Kind client.Kind `yaml:"kind" mapstructure:"kind"`

	// Database configures the connection.
	Database infra.DatabaseConfig `yaml:"database" mapstructure:"database"`
}

Config selects and tunes the pool.

type Deps added in v0.0.7

type Deps struct{}

Deps carries the pool's runtime collaborators (none today).

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