testdb

package
v0.7.19 Latest Latest
Warning

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

Go to latest
Published: May 6, 2026 License: MIT Imports: 9 Imported by: 0

Documentation

Overview

Package testdb provides shared test helpers for booting a throwaway Postgres container and running migrations.

This package imports `testing`, so it must be imported only from `*_test.go` files.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func BootPG

func BootPG(t *testing.T) (*pgxpool.Pool, func())

BootPG starts a throwaway Postgres 16 container, runs all migrations, and returns a ready-to-use pgx pool + a cleanup func the caller must defer.

func BootPGWithDSN

func BootPGWithDSN(t *testing.T) (string, func())

BootPGWithDSN is like BootPG but returns the DSN instead of a pool. Intended for callers that want to open their own pool (e.g., CLI tests that exercise pgxpool.New from inside the code under test).

Types

This section is empty.

Jump to

Keyboard shortcuts

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