Documentation ¶
Overview ¶
Package clickhouse exposes an opinionated way to interact with ClickHouse.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Batch ¶
type Batch interface { Append(ctx context.Context, v any) error Abort(ctx context.Context) error Flush(ctx context.Context) error Send(ctx context.Context) error IsSent(ctx context.Context) bool }
Batch exposes an opinionated way to interact with a ClickHouse batch capabilities. All functions are wrapped with a context because some of them automatically do distributed tracing (by using the said context) as well as error recording within traces.
type ClickHouse ¶
type ClickHouse interface { Query(ctx context.Context, query string, args ...any) (driver.Rows, error) QueryRow(ctx context.Context, query string, args ...any) driver.Row PrepareBatch(ctx context.Context, query string) (Batch, error) Exec(ctx context.Context, query string, args ...any) error AsyncInsert(ctx context.Context, query string, wait bool) error }
ClickHouse exposes an opinionated way to interact with ClickHouse, by bringing automatic distributed tracing as well as error recording within traces.
func Connect ¶
func Connect(cfg Config) (ClickHouse, error)
Connect tries to connect to the ClickHouse server given the Config. Returns an error if Config is not valid or if the connection failed.
type Config ¶
type Config struct { // Addresses are ClickHouse addresses to connect to. // // Default: // // []string{"127.0.0.1:8123"} Addresses []string `json:"addresses"` // Database is the database to connect to. // // Default: // // "default" Database string `json:"-"` // User is the user to use to connect to the database. User string `json:"-"` // Password is the user's password to connect to the database. Password string `json:"-"` // TLSConfig configures TLS to communicate with the ClickHouse server. TLS integration.ConfigTLS `json:"tls"` }
Config is used to configure the ClickHouse integration.