clickhouse

package
v0.1.2 Latest Latest
Warning

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

Go to latest
Published: Mar 25, 2026 License: MIT Imports: 9 Imported by: 0

Documentation

Overview

Package clickhouse provides a framework-level ClickHouse connection helper following the Optional-init pattern established by pkg/broker/kafka.

Usage:

conn, err := clickhouse.NewConnOptional(ctx, cfg, logger)
if err != nil {
    // configured but failed to connect — fail-fast or degrade
}
if conn == nil {
    // not configured — handle gracefully
}
defer conn.Close()

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func NewConnOptional

func NewConnOptional(ctx context.Context, cfg *conf.Data, l logger.Logger) (driver.Conn, error)

NewConnOptional opens a ClickHouse connection from the Data config.

Return semantics:

  • (nil, nil) — ClickHouse is not configured (Data.ClickHouse absent or no addrs).
  • (nil, err) — configured but connection/ping failed; callers can fail-fast or degrade.
  • (conn, nil) — connected successfully.

The caller is responsible for closing the connection via conn.Close().

Types

This section is empty.

Jump to

Keyboard shortcuts

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