chquery

package
v0.1.46 Latest Latest
Warning

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

Go to latest
Published: Oct 20, 2026 License: Apache-2.0 Imports: 6 Imported by: 0

Documentation

Overview

Package chquery is a single-owner alerting.Querier over one ClickHouse connection: the owner key is ignored and every rule runs against the connection's database. It is what a self-hoster runs, and the reference for a multi-owner Querier, which differs only in choosing the connection (or the identity it runs as) from the owner key.

The connection should be a read-only ClickHouse user; the guard and the readonly=2 setting are belt and braces, not a substitute for grants.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Run

func Run(ctx context.Context, conn Conn, query string, opts alerting.QueryOptions) ([]alerting.Row, error)

Run is the shared row-reading half: a multi-owner Querier calls it with the connection it chose.

func Scan

func Scan(rows driver.Rows) ([]alerting.Row, error)

Scan reads every row into alerting.Rows. A Querier that must choose its own settings (see alerting.QueryOptions.Limits) reuses this and sends its own.

Types

type Conn

type Conn interface {
	Query(ctx context.Context, query string, args ...any) (driver.Rows, error)
}

Conn is the part of clickhouse.Conn the querier uses.

type Querier

type Querier struct {
	// contains filtered or unexported fields
}

Querier implements alerting.Querier.

func New

func New(conn Conn) *Querier

New wraps conn.

func (*Querier) Query

func (q *Querier) Query(ctx context.Context, _ string, query string, opts alerting.QueryOptions) ([]alerting.Row, error)

Query runs the statement with opts applied as ClickHouse settings and returns every row. The owner key is unused.

Jump to

Keyboard shortcuts

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