test

package
v0.7.0 Latest Latest
Warning

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

Go to latest
Published: Apr 24, 2024 License: Apache-2.0 Imports: 10 Imported by: 0

Documentation

Index

Constants

View Source
const RegularConnString = "postgres://meroxauser:meroxapass@127.0.0.1:5433/meroxadb?sslmode=disable"

RegularConnString is a non-replication user connection string for the test postgres.

View Source
const RepmgrConnString = "postgres://repmgr:repmgrmeroxa@127.0.0.1:5433/meroxadb?sslmode=disable"

RepmgrConnString is a replication user connection string for the test postgres.

Variables

This section is empty.

Functions

func ConnectPool

func ConnectPool(ctx context.Context, t *testing.T, connString string) *pgxpool.Pool

func ConnectSimple

func ConnectSimple(ctx context.Context, t *testing.T, connString string) *pgx.Conn

func IsPgError

func IsPgError(is *is.I, err error, wantCode string)

func RandomIdentifier

func RandomIdentifier(t *testing.T) string

func SetupTestTable

func SetupTestTable(ctx context.Context, t *testing.T, conn Querier) string

SetupTestTable creates a new table and returns its name.

Types

type Querier

type Querier interface {
	Exec(ctx context.Context, sql string, arguments ...any) (pgconn.CommandTag, error)
	Query(ctx context.Context, sql string, args ...any) (pgx.Rows, error)
	QueryRow(ctx context.Context, sql string, args ...any) pgx.Row
}

Jump to

Keyboard shortcuts

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