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 ¶
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.
Click to show internal directories.
Click to hide internal directories.