dbpool

package
v1.4.0 Latest Latest
Warning

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

Go to latest
Published: Aug 15, 2026 License: MIT Imports: 6 Imported by: 0

Documentation

Overview

Package dbpool provides the process-wide Postgres pool used by server-side features that read the project database directly — the Studio SQL runner and Studio membership lookups.

One pool, opened lazily on first use, because these features are optional: a deployment without a DSN must still start and serve everything else. Callers get a plain error when no DSN is configured and are expected to fail closed.

Index

Constants

This section is empty.

Variables

View Source
var ErrNoDSN = errors.New("no database DSN configured (SUPATYPE_SQL_DATABASE_URL or DATABASE_URL)")

ErrNoDSN is returned when neither DSN environment variable is set.

Functions

func DSN

func DSN() string

DSN returns the configured connection string, preferring the explicit Supatype variable over the generic one so a deployment can point admin features at a different role than the app's.

func Pool

func Pool(context.Context) (*pgxpool.Pool, error)

Pool returns the shared pool, opening it on first call.

The returned error is stable across calls: it can only come from a missing or unparseable DSN, both of which are fixed at startup. Reaching the database is not attempted here — pgxpool connects lazily — so a database that is merely slow to come up does not permanently poison the pool.

Types

This section is empty.

Jump to

Keyboard shortcuts

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