package
module
Version:
v0.0.0-...-b94ca08
Opens a new window with list of versions in this module.
Published: Sep 5, 2019
License: MIT
Opens a new window with license information.
Imports: 9
Opens a new window with list of imports.
Imported by: 0
Opens a new window with list of known importers.
README
¶
psqlxtest
Create an isolated postgres database instance per test case.
Example test
func TestSomething(t *testing.T) {
dbx, drop := psqlxtest.TmpDB(t)
defer drop()
// Run in an isolated postgres database instance.
dbx.Exec(/* ... */)
}
Example usage
# Run postgres
docker run --name my-test-postgres -p 5432:5432 -d postgres
# Run your tests
go test ./mypkg
Documentation
¶
Package psqlxtest provides utilities for creating isolated postgres
database instances with sqlx connections for testing purposes.
TmpDB creates a temporary database and returns a function to remove it.
Source Files
¶
Click to show internal directories.
Click to hide internal directories.