testpg

package
v0.0.0-...-cb5b6c1 Latest Latest
Warning

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

Go to latest
Published: Jul 17, 2026 License: MIT Imports: 13 Imported by: 0

Documentation

Overview

Package testpg provides isolated PostgreSQL schemas for integration tests.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Schema

type Schema struct {
	Name string
	Pool *pgxpool.Pool
}

Schema is an isolated PostgreSQL schema whose pool uses it as search_path.

func New

func New(t testing.TB) *Schema

New creates an isolated schema. If FUNQ_TEST_DATABASE_URL is set, it uses that database. Otherwise, it programmatically spins up a PostgreSQL container using testcontainers-go and creates the isolated schema within it.

To prevent accidental destructive setup on host databases, the database name must contain "funq_test". A dedicated test database with another name may be explicitly acknowledged by setting FUNQ_TEST_DATABASE_ISOLATED=1.

Jump to

Keyboard shortcuts

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