postgres

package
v0.3.0 Latest Latest
Warning

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

Go to latest
Published: Aug 18, 2026 License: MIT Imports: 5 Imported by: 0

Documentation

Overview

Package postgres builds the connection pools.

There are deliberately two. The redirect pool is small, separate, and used only by the hot path, so that a slow analytics query holding application connections cannot leave a redirect waiting to acquire one. Milestone M13 asserts this empirically by running a two-second analytics query and checking that the redirect pool's acquire-wait stays at zero.

Index

Constants

View Source
const PingTimeout = 750 * time.Millisecond

PingTimeout is the budget for a readiness probe's database check. Kept short so a probe cannot pile up behind a struggling database.

Variables

This section is empty.

Functions

func VerifyUTC

func VerifyUTC(ctx context.Context, pool *pgxpool.Pool) error

VerifyUTC checks that sessions really are running in UTC.

Called at startup because the failure it prevents is silent and only becomes visible later, as gaps or overlaps in analytics partitions.

Types

type Pools

type Pools struct {
	App      *pgxpool.Pool
	Redirect *pgxpool.Pool
}

Pools holds the application and redirect pools.

func Open

func Open(ctx context.Context, c config.Config) (*Pools, error)

Open creates both pools and verifies connectivity.

func (*Pools) Close

func (p *Pools) Close()

Close releases both pools. Safe to call with nil fields.

Jump to

Keyboard shortcuts

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