Help us shape the future of Go! Take the 2026 Go Developer Survey

pgdbtest

package
v0.17.0 Latest Latest
Warning

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

Go to latest
Published: Oct 29, 2026 License: Apache-2.0 Imports: 8 Imported by: 0

Documentation

Overview

Package pgdbtest gives integration tests an isolated schema in a test database.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Migrated

func Migrated(tb testing.TB, urlEnv string, m pgdb.Migrations) *pgxpool.Pool

Migrated is Open with m applied.

func Open

func Open(tb testing.TB, urlEnv, params string) *pgxpool.Pool

Open returns a pool on a fresh, empty schema, dropped when the test ends. params are added to the URL's query, such as "pool_max_conns=2".

func Schema

func Schema(tb testing.TB, urlEnv string) (url, schema string)

Schema reserves a fresh schema name in the database whose URL is in the environment variable urlEnv, dropped when the test ends, and returns the URL with it. It skips the test when urlEnv is not set.

Types

This section is empty.

Jump to

Keyboard shortcuts

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