clickhouseinfra

package
v0.2.0 Latest Latest
Warning

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

Go to latest
Published: May 16, 2024 License: Apache-2.0 Imports: 13 Imported by: 0

Documentation

Overview

Package clickhouseinfra provides a set of functions to interact with ClickHouse containers.

Index

Constants

View Source
const (
	SecureNativePort = nat.Port("9440/tcp")
)

Variables

This section is empty.

Functions

func WithCerts added in v0.2.0

func WithCerts(caCert, clientCerts *tlscert.Certificate) testcontainers.CustomizeRequestOption

WithCerts is a customize request option that adds the certificates to the clickhouse container.

Types

type ColInfo

type ColInfo struct {
	Name    string
	Type    string
	Comment string
}

ColInfo is a struct that holds the column meta information.

func GetCurrentCols

func GetCurrentCols(ctx context.Context, chConn clickhouse.Conn, tableName string) ([]ColInfo, error)

GetCurrentCols returns the current columns of the table.

type Container

type Container struct {
	*chmodule.ClickHouseContainer
	RootCAs *x509.CertPool
}

Container is a struct that holds the clickhouse and zookeeper containers.

func CreateClickHouseContainer

func CreateClickHouseContainer(ctx context.Context, userName, password string) (*Container, error)

CreateClickHouseContainer function starts and testcontainer for clickhouse. The caller is responsible for terminating the container.

func (*Container) ConnectionHost added in v0.2.0

func (c *Container) ConnectionHost(ctx context.Context) (string, error)

ConnectionHost returns the host and port of the clickhouse container, using the default, native 9000 port, and obtaining the host and exposed port from the container

func (*Container) GetClickHouseAsConn added in v0.2.0

func (c *Container) GetClickHouseAsConn() (clickhouse.Conn, error)

GetClickHouseAsConn function returns a clickhouse.Conn connection which uses native ClickHouse protocol.

func (*Container) GetClickhouseAsDB added in v0.2.0

func (c *Container) GetClickhouseAsDB(ctx context.Context) (*sql.DB, error)

GetClickhouseAsDB function returns a sql.DB connection which allows interfaceing with the stdlib database/sql package.

func (*Container) Terminate

func (c *Container) Terminate(ctx context.Context)

Terminate function terminates the clickhouse containers. If an error occurs, it will be printed to stderr.

Jump to

Keyboard shortcuts

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