chtest

package
v0.2.0 Latest Latest
Warning

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

Go to latest
Published: Sep 10, 2026 License: MIT Imports: 12 Imported by: 0

Documentation

Overview

Package chtest creates isolated ClickHouse databases for tests, mirroring internal/pgtest.

ClickHouse has no search_path, so where pgtest isolates a test in a schema on a shared database, chtest isolates it in a database of its own on the shared server.

Index

Constants

View Source
const (
	Addr     = "127.0.0.1:9010"
	User     = "default"
	Password = "hunter2"
)

Addr is the local ClickHouse from docker-compose.yml. The native port is 9010 rather than 9000 so it can coexist with another project's ClickHouse.

Variables

This section is empty.

Functions

func DSN

func DSN(database string) string

DSN returns the connection string for the local test ClickHouse, pointed at database.

func NewClickHouseDB

func NewClickHouseDB(t *testing.T, sqlFiles []string) (driver.Conn, string)

NewClickHouseDB opens a connection to a randomly named, new database and runs all sqlFiles against it.

func NewClickHouseDBString

func NewClickHouseDBString(t *testing.T, sql string) (driver.Conn, string)

NewClickHouseDBString opens a connection to a randomly named, new database and runs the statements in sql against it. Statements are separated by semicolons: ClickHouse has no multi-statement Exec. It also returns the DSN for that database, for tests that drive pggen through its public API.

func Options

func Options(database string) *clickhouse.Options

Options returns the connection options for the local test ClickHouse, pointed at database.

Types

This section is empty.

Jump to

Keyboard shortcuts

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