Documentation
¶
Overview ¶
Package testdb provides isolated migrated database fixtures for tests.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func CloneMigratedSQLite ¶
CloneMigratedSQLite copies the migrated template database into t.TempDir and returns the cloned database path. The first call costs what NewMigratedSQLite describes.
func NewMigratedPostgres ¶ added in v1.28.0
NewMigratedPostgres returns an isolated migrated PostgreSQL schema when QUI_TEST_POSTGRES_DSN is configured, otherwise it skips the calling test.
func NewMigratedSQLite ¶
NewMigratedSQLite returns an isolated SQLite database with all migrations already applied, cloned from a migrated template.
The first call in a process finds the template in the user cache directory (or QUI_TESTDB_CACHE_DIR) and builds it when no template matches the current migrations. A build runs every migration: about 0.2 s without -race and about 7 s with -race. Every later clone, in any package process, is a file copy.
Types ¶
This section is empty.