testcontainers

package
v0.0.0-...-e19fd20 Latest Latest
Warning

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

Go to latest
Published: Nov 21, 2024 License: MIT Imports: 12 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type ClickHouseContainer

type ClickHouseContainer struct {
	Container testcontainers.Container
	Context   context.Context

	Hosts    []string
	Database string
}

ClickHouseContainer is a ClickHouse testcontainer

func NewClickhouseContainer

func NewClickhouseContainer(ctx context.Context) (*ClickHouseContainer, error)

NewClickhouseContainer creates new Clickhouse test container if CH_TEST_PORT is not defined. Otherwise uses db at defined port. This logic is required for running test at CI environment

func (*ClickHouseContainer) Close

func (ch *ClickHouseContainer) Close() error

Close terminates underlying docker container

func (*ClickHouseContainer) Start

func (ch *ClickHouseContainer) Start() error

func (*ClickHouseContainer) Stop

func (ch *ClickHouseContainer) Stop() error

type MySQLContainer

type MySQLContainer struct {
	Container testcontainers.Container
	Context   context.Context
	Host      string
	Port      int
	Database  string
	Username  string
	Password  string
	// contains filtered or unexported fields
}

MySQLContainer is a MySQL testcontainer

func NewMySQLContainer

func NewMySQLContainer(ctx context.Context) (*MySQLContainer, error)

NewMySQLContainer creates new MySQL test container if MYSQL_TEST_PORT is not defined. Otherwise uses db at defined port. This logic is required for running test at CI environment

func (*MySQLContainer) Close

func (mc *MySQLContainer) Close() error

Close terminates underlying mysql docker container

func (*MySQLContainer) Start

func (mc *MySQLContainer) Start() error

func (*MySQLContainer) Stop

func (mc *MySQLContainer) Stop() error

type PostgresContainer

type PostgresContainer struct {
	Container testcontainers.Container
	Context   context.Context
	Host      string
	Port      int
	Database  string
	Schema    string
	Username  string
	Password  string
	// contains filtered or unexported fields
}

PostgresContainer is a Postgres testcontainer

func NewPostgresContainer

func NewPostgresContainer(ctx context.Context) (*PostgresContainer, error)

NewPostgresContainer creates new Postgres test container if PG_TEST_PORT is not defined. Otherwise uses db at defined port. This logic is required for running test at CI environment

func (*PostgresContainer) Close

func (pgc *PostgresContainer) Close() error

Close terminates underlying postgres docker container

func (*PostgresContainer) CountRows

func (pgc *PostgresContainer) CountRows(table string) (int, error)

CountRows returns row count in DB table with name = table or error if occurred

func (*PostgresContainer) GetSortedRows

func (pgc *PostgresContainer) GetSortedRows(table, selectClause, whereClause, orderClause string) ([]map[string]any, error)

GetSortedRows returns all selected row from table ordered according to orderClause or error if occurred

func (*PostgresContainer) Start

func (pgc *PostgresContainer) Start() error

func (*PostgresContainer) Stop

func (pgc *PostgresContainer) Stop() error

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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