Documentation ¶
Index ¶
- func CreateDBTestContainer(ctx context.Context, name string, inMemory bool) (testcontainers.Container, *sql.DB, error)
- func DBForTest(name string, opts ...DBForTestOption) (db *sql.DB, resolvedData *debefix.Data, closeFunc func() error, err error)
- func DBMigrationTest(name string) (err error)
- func MigrationsPath() (string, error)
- func NewDBPGMigrator(db *sql.DB) (*migrate.Migrate, error)
- type DBForTestOption
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func CreateDBTestContainer ¶
func CreateDBTestContainer(ctx context.Context, name string, inMemory bool) (testcontainers.Container, *sql.DB, error)
CreateDBTestContainer spins up a Postgres database container
func DBForTest ¶
func DBForTest(name string, opts ...DBForTestOption) (db *sql.DB, resolvedData *debefix.Data, closeFunc func() error, err error)
DBForTest spins up a postgres container, creates the test database on it, migrates it, and returns the db and a close function. The "name" parameter will become the test database name with a "_test" suffix as required by testfixtures.
func DBMigrationTest ¶
DBMigrationTest tests the complete migration (up and down).
func MigrationsPath ¶
func NewDBPGMigrator ¶
NewDBPGMigrator creates a migrator instance
Types ¶
type DBForTestOption ¶
type DBForTestOption func(*dbForTestOptions)
func WithDBForTestDebugOutput ¶
func WithDBForTestDebugOutput(debugOutput bool) DBForTestOption
func WithDBForTestFixturesTags ¶
func WithDBForTestFixturesTags(fixturesTags []string) DBForTestOption
func WithDBForTestInDisk ¶
func WithDBForTestInDisk(inDisk bool) DBForTestOption
func WithDBForTestMergeData ¶
func WithDBForTestMergeData(data []string) DBForTestOption
Click to show internal directories.
Click to hide internal directories.