Documentation
¶
Index ¶
- func EnrichClickhouseContext(ctx context.Context) context.Context
- func IsPermissionError(err error) bool
- func NewQuerier[T any](conn *ClickhouseExecutor) querier.Querier[T]
- type ClickhouseConf
- type ClickhouseExecutor
- func (e *ClickhouseExecutor) Close() error
- func (e *ClickhouseExecutor) Exec(ctx context.Context, query string, args ...any) error
- func (e *ClickhouseExecutor) GetDb() *sqlx.DB
- func (e *ClickhouseExecutor) QueryRow(ctx context.Context, sql string, args ...interface{}) *sqlx.Row
- func (e *ClickhouseExecutor) QueryRows(ctx context.Context, q string, args ...interface{}) (*sqlx.Rows, error)
- func (e *ClickhouseExecutor) Select(ctx context.Context, dest any, query string, args ...any) error
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func EnrichClickhouseContext ¶ added in v0.9.0
EnrichClickhouseContext wraps the context with ClickHouse-specific options: - log_comment setting with JSON query context (when query context is present) - WithProgress/WithProfileInfo callbacks (when a querystats callback is registered) Creates or reuses a DriverStats accumulator so the Collector in stdsql helpers can merge the driver-specific stats at Finish() time.
func IsPermissionError ¶ added in v0.15.3
IsPermissionError reports whether err indicates the DWH credentials lack the privileges required for the attempted operation.
func NewQuerier ¶
func NewQuerier[T any](conn *ClickhouseExecutor) querier.Querier[T]
Types ¶
type ClickhouseConf ¶
type ClickhouseConf struct {
Hostname string
Port int
Username string
Password string
// DefaultDatabase is the database the connection opens with, so an unqualified
// table name in a query resolves against it. Empty opens on "default". It is
// not a scrape filter: metadata is read from system tables and covers every
// database the user can see whatever this says.
DefaultDatabase string
NoSsl bool
// Settings are ClickHouse server settings applied to every connection, written
// as they would be in a DSN query string (e.g. "max_execution_time": "300").
// They take precedence over the settings this package applies by default.
Settings map[string]string
}
type ClickhouseExecutor ¶
type ClickhouseExecutor struct {
// contains filtered or unexported fields
}
func NewClickhouseExecutor ¶
func NewClickhouseExecutor(ctx context.Context, conf *ClickhouseConf) (*ClickhouseExecutor, error)
func (*ClickhouseExecutor) Close ¶
func (e *ClickhouseExecutor) Close() error
func (*ClickhouseExecutor) GetDb ¶
func (e *ClickhouseExecutor) GetDb() *sqlx.DB
Click to show internal directories.
Click to hide internal directories.