diff options
| author | Stefan Majewsky <majewsky@gmx.net> | 2026-08-01 14:50:01 +0200 |
|---|---|---|
| committer | Stefan Majewsky <majewsky@gmx.net> | 2026-08-01 14:50:01 +0200 |
| commit | 6c174bebade1627a837e70bec827753446d6498a (patch) | |
| tree | 35a229d9601565685f2ea2e24a268bb29be6bc55 /pgruntime/pgruntime.go | |
| parent | e4a5b966decd910213de4ecbdc1b1ed2c4daf947 (diff) | |
| parent | 6d72c85766a8355e1d660ff0c19b43e93faad4d8 (diff) | |
| download | go-gg-6c174bebade1627a837e70bec827753446d6498a.tar.gz | |
Merge branch 'pgruntime'
Diffstat (limited to 'pgruntime/pgruntime.go')
| -rw-r--r-- | pgruntime/pgruntime.go | 29 |
1 files changed, 29 insertions, 0 deletions
diff --git a/pgruntime/pgruntime.go b/pgruntime/pgruntime.go new file mode 100644 index 0000000..0283eaa --- /dev/null +++ b/pgruntime/pgruntime.go @@ -0,0 +1,29 @@ +// SPDX-FileCopyrightText: 2026 Stefan Majewsky <majewsky@gmx.net> +// SPDX-License-Identifier: Apache-2.0 + +// Package pgruntime provides connection handling for PostgreSQL databases, +// including optional support for database migrations and self-contained test DB instances. +// It can be used with any PostgreSQL data driver, including [lib/pq] and [pgx]. +// +// # Basic usage +// +// In productive scenarios, build a [ConnectionTarget] instance from configuration values or command-line arguments, and call [Connector.Connect]. +// In test scenarios, call [Connector.ConnectForTest]. +// +// Both situations require a [Connector] instance: +// When using an std-compatible driver like [lib/pq], use [StdConnector]. +// Otherwise, a custom [Connector] implementation must be supplied. +// For [pgx], the connectors from [gg-pgx] may be used. +// +// # Legacy +// +// This is a clean-room reimplementation of one half of [easypg] with several interface improvements and cleanups, most notably: +// - The hard dependency on lib/pq has been removed. +// - Support for creating databases on first use has been removed (except in ConnectForTest). +// - The reset logic in ConnectForTest is completely reworked and massively simplified. +// +// [easypg]: https://pkg.go.dev/github.com/sapcc/go-bits/easypg +// [lib/pq]: https://pkg.go.dev/github.com/lib/pq +// [pgx]: https://pkg.go.dev/github.com/jackc/pgx/v5 +// [gg-pgx]: https://git.xyrillian.de/go-gg-pgx/ +package pgruntime |
