Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func ConnectAndMigrateDB ¶
func ConnectAndMigrateDB(packageName string)
func ConnectToTestDB ¶
func ConnectToTestDB(dbSchema string)
ConnectToTestDB connects to the test database, populates the "dao.DB" member, and runs a schema migration.
func CreateFixtures ¶
func CreateFixtures(schema string)
CreateFixtures creates a new schema, migrates the schema and adds the required fixtures for the tests.
func CreateTestDB ¶
func CreateTestDB()
CreateTestDB creates a test database. The function terminates the program with a code 0 if the creating is successful.
func DoneWithFixtures ¶
func DoneWithFixtures(schema string)
DoneWithFixtures drops the schema and returns the "DB" object back to the "public" schema, in case any other tests need the database in the previous schema.
func UpdateTablesSequences ¶
func UpdateTablesSequences()
UpdateTablesSequences loops over all the tables from the database to update the tables' sequences to the latest id. When inserting data with an ID, for example `INSERT INTO mytable(id, desc) VALUES (1, "My description")`, the sequence doesn't get updated because an explicit ID was given. Therefore, if in the subsequent calls the ID is omitted, this could lead to "unique constraint violation" errors because of a duplicate id.
Types ¶
This section is empty.