Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
var ( // ErrNoMigrations occurs if no migration files can be found on disk ErrNoMigrations = errors.New("no migrations found") )
Functions ¶
func ExecuteScript ¶
ExecuteScript executes the passed in SQL script against the passed in db
func GetConnStr ¶
GetConnStr returns a connection string for the database software used
func IsMigrated ¶
IsMigrated returns true if the database is migrated to the latest migration in the db/migrations folder. It also returns the current database migration version number.
func SetupTestSuite ¶
func SetupTestSuite(cfg abcconfig.DBConfig, testdata TestdataFunc) (int, error)
SetupTestSuite executes the migrations "up" against the passed in database and also inserts the test data defined in testdata.sql and returns the number of migrations run.
SetupTestSuite is used primarily as a testing helper, and is called in controllers_test.go to set up the database state for the controller tests.
Types ¶
type TestdataFunc ¶
TestdataFunc is the function signature for the sql testdata function that performs database operations once the test suite is initialized with migrations and the sql testdata file.