golazy.dev
–
golazy.dev
/
pg
Index
|
Files
|
Directories
package pg ¶
import "golazy.dev/pg"
Functions ¶
func AddonDefinition ¶
AddonDefinition returns a copy of the named definition from this module's embedded lazyaddon.toml manifest. Add-on packages use it to keep runtime registration aligned with the distribution manifest.
func AddonDefinition(id string) (lazyaddon.Definition, bool)
func FromContext ¶
FromContext returns the PostgreSQL pool carried by ctx.
func FromContext(ctx context.Context) (*pgxpool.Pool, bool)
func Open ¶
Open creates a pgx pool for databaseURL.
func Open(ctx context.Context, databaseURL string) (*pgxpool.Pool, error)
func OpenEnv ¶
OpenEnv creates a pgx pool from the first non-empty environment variable in names. If names is empty, DATABASE_URL is used.
func OpenEnv(ctx context.Context, names ...string) (*pgxpool.Pool, error)
func WithPool ¶
WithPool returns a context carrying pool.
func WithPool(ctx context.Context, pool *pgxpool.Pool) context.Context
Directories ¶
| Path | Synopsis |
|---|---|
| pg/addon/postgres | Package postgres registers the base PostgreSQL add-on for GoLazy apps. |
| pg/addon/postgres/jobs | Package jobs registers the PostgreSQL-backed jobs add-on for GoLazy apps. |
| pg/pgauth | Package pgauth provides a PostgreSQL-backed lazyauth.Authenticator. |
| pg/pgfiles | Package pgfiles implements a PostgreSQL repository for golazy.dev/lazyfiles. |
| pg/pgjobs | Package pgjobs implements a PostgreSQL backend for golazy.dev/lazyjobs. |
| pg/pgmedia | Package pgmedia implements a PostgreSQL repository for golazy.dev/lazymedia. |
| pg/pgmigrate | Package pgmigrate implements PostgreSQL migrations for golazy.dev/lazymigrate. |
| pg/pgstorage | Package pgstorage implements a PostgreSQL object store for golazy.dev/lazystorage. |
| pg/withpg | Package withpg starts embedded PostgreSQL servers for local development and integration tests. |
| pg/withpg/cmd/withpg |
Package pg contains PostgreSQL helpers shared by concrete GoLazy PostgreSQL backends and applications.
Most GoLazy applications install the conventional pool and migration wiring with:
Applications with custom lifecycle requirements can open and attach the application-owned pool directly:
pool, err := pg.OpenEnv(ctx) if err != nil { return err } defer pool.Close() ctx = pg.WithPool(ctx, pool)Backend packages such as pgauth, pgmigrate, pgjobs, and other pg/* implementations can then share that pool with pg.FromContext.