Documentation ¶
Index ¶
- Constants
- type Postgres
- func (p *Postgres) CreateDB(ctx context.Context, logf func(string, ...any), name, schema string) (db *sql.DB, dsn string, cleanup func(), err error)
- func (p *Postgres) DSN(dbname string) string
- func (p *Postgres) Flush()
- func (p *Postgres) Pid() int
- func (p *Postgres) Shutdown() error
- func (p *Postgres) ShutdownAlone() error
- func (p *Postgres) Start(ctx context.Context, logf func(string, ...any)) error
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) Pid ¶
Pid returns the pid of the postgres process. It is an error to call Pid before Start.
func (*Postgres) Shutdown ¶
Shutdown waits for any inflight database cleanup functions to finish and then shutsdown postgres.
func (*Postgres) ShutdownAlone ¶
ShutdownAlone is like Shutdown, but it leaves postgres running.
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. |
Click to show internal directories.
Click to hide internal directories.