Documentation
¶
Overview ¶
Package database provides functions to migrate the database.
Index ¶
- Constants
- func GetMigrate(connString string) (*migrate.Migrate, error)
- func GetPrimeTemplate() ([]byte, error)
- func GetVersion(connString string) (uint, bool, error)
- func MigrateDown(_ context.Context, db *pgx.Conn, steps int) error
- func MigrateUp(_ context.Context, db *pgx.Conn) error
- func SetupTestDB(t *testing.T) (*pgx.Conn, func())
- func SetupTestDBContainer(t *testing.T, ctx context.Context) (*pgx.Conn, func())
Constants ¶
View Source
const ( // DBName is the name of the test database DBName = "testdb" // DBUser is the username for the root user of the test database DBUser = "testuser" // DBPass is the password for the root user of the test database DBPass = "testpass" )
Variables ¶
This section is empty.
Functions ¶
func GetMigrate ¶
GetMigrate creates a new migrate instance using the embedded migrations
func GetPrimeTemplate ¶ added in v0.3.0
GetPrimeTemplate returns the contents of the prime.sql.tmpl template file
func GetVersion ¶
GetVersion returns the current migration version
func MigrateDown ¶
MigrateDown reverts the last migration
func SetupTestDB ¶
SetupTestDB creates a Postgres container using testcontainers and runs all migrations
Types ¶
This section is empty.
Click to show internal directories.
Click to hide internal directories.