Documentation
¶
Overview ¶
Package postgrestest provides a package intended for running tests which require a Postgres backend.
Index ¶
Constants ¶
This section is empty.
Variables ¶
var ErrDisabled = errgo.New("postgres testing is disabled")
ErrDisabled is returned by New when postgres testing has been explicitly disabled.
Functions ¶
This section is empty.
Types ¶
type DB ¶
DB holds a connection to a schema within a Postgres database. The schema is created by New and deleted (along with all the tables) when the DB is closed.
func New ¶
New connects to a Postgres instance and returns a database connection that uses a newly created schema with a random name. The PG* environment variables may be used to configure the connection parameters (see https://www.postgresql.org/docs/9.3/static/libpq-envars.html).
The returned DB instance must be closed after it's finished with.
If the environment variable PGTESTDISABLE is non-empty ErrDisabled will be returned.
If the environment variable PGTESTKEEPDB is non-empty, the name of the test schema will be printed and the data will not be deleted.