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

pgtest

package
v0.2.5 Latest Latest
Warning

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

Go to latest
Published: Nov 1, 2026 License: MIT Imports: 11 Imported by: 0

Documentation

Overview

Package pgtest gives each test its own migrated Postgres database.

DIFFX_TEST_DATABASE_URL (a postgres:// URL whose role may create databases) selects a running server; otherwise one container starts per test process and Ryuk removes it when the process exits. A template database migrated by the embedded schema is created once per schema and cloned for every test.

Index

Constants

View Source
const EnvURL = "DIFFX_TEST_DATABASE_URL"

EnvURL names the variable selecting an existing server.

View Source
const Image = "postgres:18-alpine@sha256:10a5c69a83035ab5239f5620d708520e8b28f5aa1f2b20143e6024532edadfb5"

Image is the pinned server for tests and development.

Variables

This section is empty.

Functions

func Store

func Store(t testing.TB) *pgstore.Store

Store opens a store on a fresh database, closed when the test ends.

func URL

func URL(t testing.TB) string

URL returns a connection string for a fresh migrated database that is dropped when the test ends.

Types

This section is empty.

Jump to

Keyboard shortcuts

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