testutil

package
v0.1.1 Latest Latest
Warning

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

Go to latest
Published: Jan 28, 2026 License: MIT Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type PostgresContainer

type PostgresContainer struct {
	Container testcontainers.Container
	Host      string
	Port      int
	User      string
	Password  string
	Database  string
}

PostgresContainer holds the testcontainer and connection details

func SetupPostgresContainer

func SetupPostgresContainer(t *testing.T, cfg ...PostgresContainerConfig) *PostgresContainer

SetupPostgresContainer creates and starts a PostgreSQL testcontainer

func (*PostgresContainer) DSN

func (pc *PostgresContainer) DSN() string

DSN returns the PostgreSQL connection string

func (*PostgresContainer) Terminate

func (pc *PostgresContainer) Terminate() error

Terminate stops and removes the container

func (*PostgresContainer) ToPgxConfig

func (pc *PostgresContainer) ToPgxConfig() map[string]interface{}

ToPgxConfig returns configuration compatible with go-kit/pgx.Config

type PostgresContainerConfig

type PostgresContainerConfig struct {
	Image    string
	User     string
	Password string
	Database string
}

PostgresContainerConfig holds configuration for PostgreSQL container

func DefaultPostgresConfig

func DefaultPostgresConfig() PostgresContainerConfig

DefaultPostgresConfig returns default configuration for PostgreSQL container

Jump to

Keyboard shortcuts

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