pgtesting

package
v0.7.0 Latest Latest
Warning

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

Go to latest
Published: Dec 27, 2021 License: Apache-2.0 Imports: 16 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func NewDB

func NewDB(t *testing.T, dbName string) *pgxpool.Pool

NewDB creates a new database named as a sanitized dbName. It returns a connection pool to this database. It must be called after StartDockerContainer.

Types

type DockerContainerConfig

type DockerContainerConfig struct {
	// DBName is the name of the postgres database.
	DBName string

	// Version is the Postgres version ran in the container (default is 13).
	Version string

	// Expire container that takes more than `Expire` seconds running.
	// It is very important to use when you are debugging and killed the
	// process before the call the teardown or if a panic happens.
	Expire uint
}

type DockerizedPostgres

type DockerizedPostgres struct {
	Pool *pgxpool.Pool
	Port string
}

func StartDockerContainer

func StartDockerContainer(cfg DockerContainerConfig) (_ *DockerizedPostgres, teardownFn func(), err error)

Jump to

Keyboard shortcuts

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