stdpgtest

package module
v0.0.1 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jan 1, 2025 License: MIT Imports: 10 Imported by: 1

Documentation

Overview

Package stdpgtest provides testing against a postgresql database.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func SetupPgxPool

func SetupPgxPool(ctx context.Context, tb testing.TB, snapshotFile, connString string) *pgxpool.Pool

SetupPgxPool will init a isolated test database from a connection string and a snapshot sql file.

Types

type SnapshotMigrater

type SnapshotMigrater[T interface {
	ExecContext(ctx context.Context, query string, args ...any) (sql.Result, error)
}] string

SnapshotMigrater loads a migration from a postgres dump file.

func (SnapshotMigrater[T]) Hash

func (m SnapshotMigrater[T]) Hash() (string, error)

Hash implements the migrater interface.

func (SnapshotMigrater[T]) Migrate

func (m SnapshotMigrater[T]) Migrate(ctx context.Context, db T, _ pgtestdb.Config) error

Migrate performs the actual migration.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL