pgdbtest

package
v0.0.0-...-e34d481 Latest Latest
Warning

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

Go to latest
Published: Apr 20, 2026 License: MIT Imports: 10 Imported by: 0

Documentation

Overview

Package pgdbtest boots a throwaway Postgres via testcontainers-go and returns a connected *pgdb.Postgres with migrations already applied.

The container is shared across tests in a single `go test` process; each call to New truncates the domain tables so tests see an empty database.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Exec

func Exec(t testing.TB, sql string, args ...any)

Exec runs raw SQL against the container — for seeding and assertions. Tests should use the *pgdb.Postgres returned from New for the code under test; this is just for setup and teardown plumbing.

func New

func New(t testing.TB) *pgdb.Postgres

New returns a *pgdb.Postgres backed by a testcontainers Postgres. The container is booted lazily on first call and reused for the life of the test process.

Types

This section is empty.

Jump to

Keyboard shortcuts

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