Documentation
¶
Overview ¶
Package pgtest gives each test a fresh PostgreSQL database cut from a migrated template, and sweeps stale ones.
Index ¶
- func Migrator(hash string, migrate func(ctx context.Context, db *sql.DB) error) pgtestdb.Migrator
- func New(t testing.TB, address string, migrator pgtestdb.Migrator) string
- func NewSwept(t testing.TB, address string, olderThan time.Duration, ...) string
- func Sweep(ctx context.Context, address string, olderThan time.Duration) ([]string, error)
- func URL(cfg pgtestdb.Config) string
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func Migrator ¶
Migrator returns a pgtestdb migrator that builds its template with migrate once per hash.
func New ¶
New returns the escaped address of a fresh database cut from the template migrator builds on the server of address.
func NewSwept ¶ added in v0.2.0
func NewSwept(t testing.TB, address string, olderThan time.Duration, migrator pgtestdb.Migrator) string
NewSwept sweeps the stale test databases of the server at address once per test process, then answers New.
Types ¶
This section is empty.
Click to show internal directories.
Click to hide internal directories.