clickhouse

package
v0.5.0 Latest Latest
Warning

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

Go to latest
Published: Jul 12, 2025 License: Apache-2.0 Imports: 19 Imported by: 0

Documentation

Overview

The code on this file is mostly imported from the clickhouse-go project in https://github.com/ClickHouse/clickhouse-go/blob/main/struct_map.go; The original license is maintained

Licensed to ClickHouse, Inc. under one or more contributor license agreements. See the NOTICE file distributed with this work for additional information regarding copyright ownership. ClickHouse, Inc. licenses this file to you under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at

http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.

Index

Constants

View Source
const (
	ErrEmptyHosts             = utils.Error("empty hosts")
	ErrNilConfig              = utils.Error("Nil Config")
	ErrInvalidCompression     = utils.Error("invalid compression value")
	ErrInvalidDialTimeout     = utils.Error("invalid dial timeout value")
	ErrInvalidMaxOpenConns    = utils.Error("invalid max open connections value")
	ErrInvalidMaxIdleConns    = utils.Error("invalid max idle connections value")
	ErrInvalidConnMaxLifetime = utils.Error("invalid connMaxLifetime value")
	ErrInvalidConnStrategy    = utils.Error("invalid connStrategy value")

	CompressionLZ4     = "lz4"
	CompressionNone    = "none"
	CompressionZSTD    = "zstd"
	CompressionGZIP    = "gzip"
	CompressionBrotli  = "br"
	CompressionDeflate = "deflate"

	ConnSequential = "sequential"
	ConnRoundRobin = "roundRobin"
)
View Source
const (
	ErrNotSupported      = utils.Error("method not supported")
	ErrInvalidParameters = utils.Error("invalid parameters")
)
View Source
const (
	MigrationTable = "db_migration"
)

Variables

This section is empty.

Functions

func DialectOptions added in v0.2.0

func DialectOptions() *goqu.SQLDialectOptions

func NewMigrationManager added in v0.4.2

func NewMigrationManager(ctx context.Context, client *Client, cluster string) (migrations.Manager, error)

Types

type Client

type Client struct {
	Conn    clickhouse.Conn
	Version *clickhouse.ServerVersion
}

func NewClient

func NewClient(config *ClientConfig) (*Client, error)

func (*Client) Close added in v0.4.0

func (c *Client) Close() error

func (*Client) NewRepository added in v0.4.0

func (c *Client) NewRepository(ctx context.Context, tableName string) Repository

NewRepository create a new repository

func (*Client) Ping added in v0.4.0

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

func (*Client) Stats added in v0.4.0

func (c *Client) Stats() driver.Stats

type ClientConfig

type ClientConfig struct {
	Hosts                          []string       `json:"hosts"`
	Database                       string         `json:"database"`
	Username                       string         `json:"username"`
	Debug                          bool           `json:"debug"`       //Debug true/false to enable debugging
	Compression                    string         `json:"compression"` // Compression algorithm: lz4, none
	DialTimeout                    int            `json:"dialTimeout"`
	MaxOpenConns                   int            `json:"maxOpenConns"`
	MaxIdleConns                   int            `json:"maxIdleConns"`
	ConnMaxLifetime                int            `json:"connMaxLifetime"`
	ConnStrategy                   string         `json:"connStrategy"` // either sequential or roundRobin
	BlockBufferSize                uint8          `json:"blockBufferSize"`
	Settings                       map[string]any `json:"settings"`
	secure.DefaultCredentialConfig                // optional password
	tlsProvider.ClientConfig
}

func NewClientConfig added in v0.4.0

func NewClientConfig() *ClientConfig

func (ClientConfig) Validate

func (c ClientConfig) Validate() error

type Repository added in v0.4.0

func NewRepository added in v0.4.0

func NewRepository(ctx context.Context, conn clickhouse.Conn, tableName string) Repository

Jump to

Keyboard shortcuts

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