testdb

package
v0.0.0-...-2d46e94 Latest Latest
Warning

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

Go to latest
Published: Mar 9, 2024 License: MIT Imports: 10 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type TestDB

type TestDB struct {
	// contains filtered or unexported fields
}

func New

func New(ctx context.Context) (*TestDB, error)

New launches a new TestDB. The caller should call Close when finished to shut it down.

func (*TestDB) Close

func (db *TestDB) Close(ctx context.Context) error

Close closes the test DB connection pool and shuts down the test DB instance.

func (*TestDB) ConnectionString

func (db *TestDB) ConnectionString() (string, error)

ConnectionString returns the connection string for connecting to the test database instance

func (*TestDB) Migrate

func (db *TestDB) Migrate(migrationsPath string) error

Migrate runs DB migrations found in the migrationsPath file path

func (*TestDB) Open

func (db *TestDB) Open(ctx context.Context) (*pgxpool.Pool, error)

Open returns a connection pool for the test database instance. If the connection pool is not closed explicitly, it will be closed when the TestDB.Close method is called.

Jump to

Keyboard shortcuts

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