Documentation ¶
Overview ¶
Package sqitchdb allow "unit testing" of (postgres) database whose schema is controlled by sqitch
Calling New will start a container running postgres with the latest schema/data loaded. The Conn method return a connection to this database (sql.DB) that can be used for testing. Close will shutdown the container.
Reset will return an open database to the state that it was initially. So the idea is that it in a TestMain (or something like that) the database would start and then individual tests can start by calling Reset
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type DB ¶
type DB struct {
// contains filtered or unexported fields
}
DB represent a running database
func New ¶
New start a container and load the schema. dir is the directory that contain the sqlitch schema ver is the postgres version if tb is not nil it is used to fail tests (so that New does not return error) as well as a default for the logger function