test

package
v0.0.4 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Dec 16, 2020 License: GPL-3.0 Imports: 14 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func DropTablesMysql

func DropTablesMysql(db *sqlx.DB) error

DropTablesMysql deletes all tables in the database db is connected to

func DropTablesPostgres

func DropTablesPostgres(db *sqlx.DB) error

DropTablesPostgres deletes all tables in the database db is connected to

func InitDB

func InitDB() (*sqlx.DB, *config.Database, goqu.DialectWrapper, string, func())

InitDB claims a DB and creates a connection. The resulting database will NOT be initialized with migrations.

func InitDBUp

func InitDBUp() (*sqlx.DB, goqu.DialectWrapper, string, func())

InitDBUp claims a DB and creates a connection. The resulting database will be initialized with migrations.

func LoadTestDbConfig

func LoadTestDbConfig() (*config.Database, error)

LoadTestDbConfig can be called to create a database configuration based on environment variables.

func LoadTestTimeZone

func LoadTestTimeZone() (*time.Location, error)

LoadTestTimeZone returns the configured timezone or uses UTC if none is set.

func MustLoadTestTimeZone

func MustLoadTestTimeZone() *time.Location

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.

type DbConfig

type DbConfig struct {
	Driver      string
	DatabaseFmt string
	Username    string
	Password    string
	Host        string
	Port        int
	NumDbs      int
}

DbConfig defines information about the test database

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL