package
0.14.1
Repository: https://github.com/golden-vcr/server-common.git
Documentation: pkg.go.dev

# Packages

The querytest command manages a throwaway Postgres server running in Docker, configured so that we can run unit tests for database queries against a live Postgres database with migrations pre-applied.

# Functions

AssertCount executes a SQL statement with the form 'SELECT COUNT(*) FROM ...' and fails the test with a descriptive error message if the result value returned is not equal to wantCount.
AssertNumRowsChanged inspects a sql.Result to verify that the expected number of rows were changed by the operation.
Prepare returns a sql.DB configured so that we can run unit tests on database queries for the current project, if and only if a properly-configured querytest database container is running in docker.
PrepareTx prepares a sql.DB via Prepare, then initializes a database transaction which will be automatically rolled back when the test is done.