Documentation ¶
Index ¶
- func Migrate(ctx context.Context, pool *pgxpool.Pool, migrationsFS fs.FS, globs ...string) error
- func MigrateT(t *testing.T, pool *pgxpool.Pool, migrationsFS fs.FS, globs ...string)
- func NewPool(ctx context.Context, migrationsFS fs.FS, globs ...string) (pool *pgxpool.Pool, clean func(), err error)
- func NewPoolT(t *testing.T, migrationsFS fs.FS, globs ...string) *pgxpool.Pool
- func StartTestServer(ctx context.Context) (testserver.TestServer, error)
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func NewPool ¶
func NewPool(ctx context.Context, migrationsFS fs.FS, globs ...string) (pool *pgxpool.Pool, clean func(), err error)
NewPool creates a new pgxpool.Pool instance for testing. 1. Check if the server is already running. 2. If not, start a new test server. 3. Create a new pool. 4. Apply migrations.
func NewPoolT ¶
NewPoolT creates a new pgxpool.Pool instance for testing.
It is backed by a new in-memory cockroachdb instance and migrations are applied automatically. When the test is finished, the cockroachdb instance is stopped and connections are closed automatically.
func StartTestServer ¶
func StartTestServer(ctx context.Context) (testserver.TestServer, error)
StartTestServer starts a new test server if not already running.
Types ¶
This section is empty.
Click to show internal directories.
Click to hide internal directories.