pqx

package module
v0.2.1 Latest Latest
Warning

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

Go to latest
Published: Dec 30, 2022 License: Apache-2.0 Imports: 18 Imported by: 0

Documentation

Index

Constants

View Source
const DefaultVersion = "14.2.0"

Variables

This section is empty.

Functions

This section is empty.

Types

type Postgres

type Postgres struct {
	Version string // for a list of versions by OS, see: https://mvnrepository.com/artifact/io.zonky.test.postgres
	Dir     string
	Port    int // The port to bind postgres too. If the value is zero, a random port is assigned.

	DebugLevel int // passed to postgres using the ("-d") flag
	// contains filtered or unexported fields
}

func (*Postgres) CreateDB

func (p *Postgres) CreateDB(ctx context.Context, logf func(string, ...any), name, schema string) (db *sql.DB, dsn string, cleanup func(), err error)

Open creates a database for the schema, connects to it, and returns the *sql.DB. .. more words needed here.

func (*Postgres) DSN

func (p *Postgres) DSN(dbname string) string

func (*Postgres) Flush

func (p *Postgres) Flush()

func (*Postgres) Pid

func (p *Postgres) Pid() int

Pid returns the pid of the postgres process. It is an error to call Pid before Start.

func (*Postgres) Shutdown

func (p *Postgres) Shutdown() error

Shutdown waits for any inflight database cleanup functions to finish and then shutsdown postgres.

func (*Postgres) ShutdownAlone

func (p *Postgres) ShutdownAlone() error

ShutdownAlone is like Shutdown, but it leaves postgres running.

func (*Postgres) Start

func (p *Postgres) Start(ctx context.Context, logf func(string, ...any)) error

ctx only affects initdb and pingUntilUp; otherwise, the context is ignored.

Directories

Path Synopsis
internal
backoff
Package backoff provides a back-off timer type.
Package backoff provides a back-off timer type.
Package pqxtest provides functions for testing with an embedded live, lightweight, standalone Postgres instance optimized for fast setup/teardown and cleanup.
Package pqxtest provides functions for testing with an embedded live, lightweight, standalone Postgres instance optimized for fast setup/teardown and cleanup.

Jump to

Keyboard shortcuts

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