Documentation ¶
Index ¶
- func DropTablesMysql(db *sqlx.DB) error
- func DropTablesPostgres(db *sqlx.DB) error
- func InitDB() (*sqlx.DB, *config.Database, goqu.DialectWrapper, string, func())
- func InitDBUp() (*sqlx.DB, goqu.DialectWrapper, string, func())
- func LoadTestDbConfig() (*config.Database, error)
- func LoadTestTimeZone() (*time.Location, error)
- func MustLoadTestTimeZone() *time.Location
- type DB
- type DbConfig
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func DropTablesMysql ¶
DropTablesMysql deletes all tables in the database db is connected to
func DropTablesPostgres ¶
DropTablesPostgres deletes all tables in the database db is connected to
func InitDB ¶
InitDB claims a DB and creates a connection. The resulting database will NOT be initialized with migrations.
func InitDBUp ¶
InitDBUp claims a DB and creates a connection. The resulting database will be initialized with migrations.
func LoadTestDbConfig ¶
LoadTestDbConfig can be called to create a database configuration based on environment variables.
func LoadTestTimeZone ¶
LoadTestTimeZone returns the configured timezone or uses UTC if none is set.
func MustLoadTestTimeZone ¶
MustLoadTestTimeZone loads a timezone using LoadTestTimeZone but will panic if an error is returned
Types ¶
type DB ¶
type DB struct {
// contains filtered or unexported fields
}
DB contains structures for a test database
func ClaimNextDB ¶
func ClaimNextDB() *DB
ClaimNextDB returns the first free database. You should limit concurrency to the number of DB's you want to use, otherwise this function will panic.