pgtest

package
v0.13.0 Latest Latest
Warning

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

Go to latest
Published: Oct 7, 2026 License: MIT Imports: 9 Imported by: 0

Documentation

Overview

Package pgtest provides throwaway PostgreSQL databases for integration tests. Tests are skipped unless SF_TEST_PG_DSN points at a server where the user may create databases, for example:

SF_TEST_PG_DSN='postgres://user@127.0.0.1:5432/postgres?sslmode=disable'

Index

Constants

View Source
const EnvDSN = "SF_TEST_PG_DSN"

EnvDSN names the environment variable holding the admin DSN.

Variables

This section is empty.

Functions

func DSN

func DSN(t testing.TB) string

DSN returns a DSN for a fresh scratch database that is dropped when the test ends. It skips the test when EnvDSN is unset.

func Open

func Open(t testing.TB) *sql.DB

Open returns a *sql.DB for a fresh scratch database, closed and dropped when the test ends. It skips the test when EnvDSN is unset.

Types

This section is empty.

Jump to

Keyboard shortcuts

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