testpg

package
v1.66.0 Latest Latest
Warning

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

Go to latest
Published: Oct 13, 2026 License: Apache-2.0 Imports: 14 Imported by: 0

Documentation

Overview

Package testpg gives tests a throwaway Postgres database.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Container

func Container(ctx context.Context) (string, func(), error)

Container starts a Postgres server of its own, outside any test, and returns the DSN of its empty postgres database and a func that stops it.

func Start

func Start(t testing.TB) string

Start returns the superuser DSN of a new, empty database of its own, dropped when the test ends. Every test of a binary shares one Postgres container. The test is skipped in short mode, and without Docker unless CI is set.

func WithApp

func WithApp(t testing.TB) (superuser, app string)

WithApp is Start, and the DSN of a role that may only create schemas in that database, as the servers' own role may.

Types

This section is empty.

Jump to

Keyboard shortcuts

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