clickhouseinfra

package
v0.1.2 Latest Latest
Warning

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

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

Documentation

Overview

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

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func GetClickHouseAsConn

func GetClickHouseAsConn(container *chmodule.ClickHouseContainer) (clickhouse.Conn, error)

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

func GetClickhouseAsDB

func GetClickhouseAsDB(ctx context.Context, container *chmodule.ClickHouseContainer) (*sql.DB, error)

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

func StartZooKeeperContainer

func StartZooKeeperContainer(ctx context.Context) (testcontainers.Container, string, error)

StartZooKeeperContainer function starts a zookeeper container. The caller is responsible for terminating the 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
	ZooKeeperContainer testcontainers.Container
}

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) Terminate

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

Terminate function terminates the clickhouse and zookeeper 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