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

embedpg

package
v0.4.1 Latest Latest
Warning

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

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

Documentation

Overview

Package embedpg starts one embedded Postgres per process for tests. Production packages do not import it. DRIVESYNC_STORE=postgres selects it; the default is sqlite, decided by the caller.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func DropSchema

func DropSchema(db *sql.DB, schema string)

DropSchema removes a test schema. It ignores errors so cleanup stays quiet.

func NewSchema

func NewSchema() string

NewSchema returns a lowercase schema name unique to one test.

func Postgres

func Postgres() bool

Postgres reports whether this process should open the Postgres metadata store.

func SharedDB

func SharedDB(t testing.TB) *sql.DB

SharedDB returns the process-wide embedded database. The caller owns schemas created in it and must not close the pool.

func Shutdown

func Shutdown()

Shutdown stops the process-wide embedded server and deletes its files. TestMain calls it so a finished package leaves neither a postmaster nor its few hundred megabytes behind. macOS allows only a few System V shared-memory IDs, and a leaked server holds one.

Types

This section is empty.

Jump to

Keyboard shortcuts

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