clickhouse

package
v0.0.10 Latest Latest
Warning

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

Go to latest
Published: Jun 20, 2025 License: GPL-3.0 Imports: 9 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ParseErrorCode

func ParseErrorCode(err error) string

Types

type Client

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

Client represents a ClickHouse client for data storage

func NewClient

func NewClient(ctx context.Context, log logrus.FieldLogger, config *Config) (*Client, error)

NewClient creates a new ClickHouse client

func (*Client) GetDB

func (c *Client) GetDB() *sql.DB

GetDB returns the underlying database connection

func (*Client) QueryRow

func (c *Client) QueryRow(ctx context.Context, table, query string) *sql.Row

QueryRow executes a query and returns a single row

func (*Client) Start

func (c *Client) Start(ctx context.Context) error

func (*Client) Stop

func (c *Client) Stop(ctx context.Context) error

func (*Client) WithLabels added in v0.0.5

func (c *Client) WithLabels(network, processor string) *Client

WithLabels sets the network and processor labels for metrics

type Config

type Config struct {
	DSN          string `yaml:"dsn" default:"http://localhost:8123/default"`
	MaxOpenConns int    `yaml:"maxOpenConns" default:"10"`
	MaxIdleConns int    `yaml:"maxIdleConns" default:"10"`
	Network      string // Network name for metrics
	Processor    string // Processor name for metrics
}

func (*Config) Validate

func (c *Config) Validate() error

Jump to

Keyboard shortcuts

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