Documentation ¶
Index ¶
- func CleanupTestDb(db *sqlx.DB) error
- func DropAllTables(db *sqlx.DB) error
- func InitializeDatabase(db *sqlx.DB, migrationsDir, fixturesDir string) error
- func LoadFixtures(db *sqlx.DB, fixturesDirectory string) error
- type PostgresConfig
- func (cfg *PostgresConfig) Cleanup(ctx context.Context) error
- func (cfg *PostgresConfig) GetContainerName() string
- func (cfg *PostgresConfig) GetDbConn() (*sqlx.DB, error)
- func (cfg *PostgresConfig) GetDbVar() string
- func (cfg *PostgresConfig) GetPasswordVar() string
- func (cfg *PostgresConfig) GetPort() int
- func (cfg *PostgresConfig) GetUserVar() string
- func (cfg *PostgresConfig) LaunchDockerInstance(ctx context.Context) (*sqlx.DB, error)
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func CleanupTestDb ¶
CleanupTestDb truncates tables that are usually populated with fixtures. The set of tables is hardcoded.
func DropAllTables ¶
DropAllTables enumerates all tables and drops them.
func InitializeDatabase ¶
InitializeDatabase drops all tables in the provided database, then runs the migrations found in the migrationsDir, then loads the fixtures found in fixturesDir.
Types ¶
type PostgresConfig ¶
type PostgresConfig struct { // Used to configure the database Username string Password string Database string // Used to generate the database name Service string Realm string // contains filtered or unexported fields }
func (*PostgresConfig) GetContainerName ¶
func (cfg *PostgresConfig) GetContainerName() string
func (*PostgresConfig) GetDbVar ¶
func (cfg *PostgresConfig) GetDbVar() string
func (*PostgresConfig) GetPasswordVar ¶
func (cfg *PostgresConfig) GetPasswordVar() string
func (*PostgresConfig) GetPort ¶
func (cfg *PostgresConfig) GetPort() int
func (*PostgresConfig) GetUserVar ¶
func (cfg *PostgresConfig) GetUserVar() string
func (*PostgresConfig) LaunchDockerInstance ¶
Click to show internal directories.
Click to hide internal directories.