pgtest

package
v0.0.0-...-34b142b Latest Latest
Warning

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

Go to latest
Published: Mar 2, 2026 License: MIT Imports: 18 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func PrityPostgresError

func PrityPostgresError(err error, sql string) error

PrityPostgresError returns a formatted error message for PostgreSQL errors.

Types

type PostgresTest

type PostgresTest struct {
	Env map[string]string
	// contains filtered or unexported fields
}

PostgresTest is a test helper for postgres.

It creates a postgres instance in a docker container. Can be used with flow_postgres.

func NewPostgresTest

func NewPostgresTest(ctx context.Context) (*PostgresTest, error)

NewPostgresTest creates a PostgresTest instance to test against a postgres server in a docker container.

func (*PostgresTest) AddData

func (tp *PostgresTest) AddData(ctx context.Context, data string) error

AddData adds data in yaml-format to the database.

func (*PostgresTest) Cleanup

func (tp *PostgresTest) Cleanup(t *testing.T)

Cleanup uses t.cleanup to register a cleanup function after the test is done.

This can be used to reuse a PostgresTest without restarting the postgres server.

func (*PostgresTest) Close

func (tp *PostgresTest) Close() error

Close closes the postgres instance by removing the postgres container.

func (*PostgresTest) Conn

func (tp *PostgresTest) Conn(ctx context.Context) (*pgx.Conn, error)

Conn returns a pgx connection to the postgres server.

func (*PostgresTest) Flow

func (tp *PostgresTest) Flow() (*datastore.FlowPostgres, error)

Flow returns a flow that is using the postgres instance.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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