v2 – github.com/ClickHouse/clickhouse-go/v2 Index | Files | Directories

package clickhouse

import "github.com/ClickHouse/clickhouse-go/v2"

Index

Variables

var (
	ErrBatchAlreadySent               = errors.New("clickhouse: batch has already been sent")
	ErrAcquireConnTimeout             = errors.New("clickhouse: acquire conn timeout. you can increase the number of max open conn or the dial timeout")
	ErrUnsupportedServerRevision      = errors.New("clickhouse: unsupported server revision")
	ErrBindMixedNamedAndNumericParams = errors.New("clickhouse [bind]: mixed named and numeric parameters")
)
var CompressionLZ4 compress.Method = compress.LZ4

Functions

func Context

func Context(parent context.Context, options ...QueryOption) context.Context

func Named

func Named(name string, value interface{}) driver.NamedValue

func Open

func Open(opt *Options) (driver.Conn, error)

func OpenDB

func OpenDB(opt *Options) *sql.DB

Types

type Auth

type Auth struct {
	Database string
	Username string
	Password string
}

type Compression

type Compression struct {
	Method compress.Method
}

type Conn

type Conn = driver.Conn

type ConnOpenStrategy

type ConnOpenStrategy uint8
const (
	ConnOpenInOrder ConnOpenStrategy = iota
	ConnOpenRoundRobin
)

type Exception

type Exception = proto.Exception

type Log

type Log struct {
	Time      time.Time
	TimeMicro uint32
	Hostname  string
	QueryID   string
	ThreadID  uint64
	Priority  int8
	Source    string
	Text      string
}

type OpError

type OpError struct {
	Op         string
	ColumnName string
	Err        error
}

func (*OpError) Error

func (e *OpError) Error() string

type Options

type Options struct {
	TLS              *tls.Config
	Addr             []string
	Auth             Auth
	DialContext      func(ctx context.Context, addr string) (net.Conn, error)
	Debug            bool
	Settings         Settings
	Compression      *Compression
	DialTimeout      time.Duration // default 1 second
	MaxOpenConns     int           // default MaxIdleConns + 5
	MaxIdleConns     int           // default 5
	ConnMaxLifetime  time.Duration // default 1 hour
	ConnOpenStrategy ConnOpenStrategy
}

func ParseDSN

func ParseDSN(dsn string) (*Options, error)

type ProfileEvent

type ProfileEvent struct {
	Hostname    string
	CurrentTime time.Time
	ThreadID    uint64
	Type        string
	Name        string
	Value       int64
}

type ProfileInfo

type ProfileInfo = proto.ProfileInfo

type Progress

type Progress = proto.Progress

type QueryOption

type QueryOption func(*QueryOptions) error

func WithExternalTable

func WithExternalTable(t ...*external.Table) QueryOption

func WithLogs

func WithLogs(fn func(*Log)) QueryOption

func WithProfileEvents

func WithProfileEvents(fn func([]ProfileEvent)) QueryOption

func WithProfileInfo

func WithProfileInfo(fn func(*ProfileInfo)) QueryOption

func WithProgress

func WithProgress(fn func(*Progress)) QueryOption

func WithQueryID

func WithQueryID(queryID string) QueryOption

func WithQuotaKey

func WithQuotaKey(quotaKey string) QueryOption

func WithSettings

func WithSettings(settings Settings) QueryOption

func WithSpan

func WithSpan(span trace.SpanContext) QueryOption

func WithStdAsync

func WithStdAsync(wait bool) QueryOption

type QueryOptions

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

type ServerVersion

type ServerVersion = proto.ServerHandshake

type Settings

type Settings map[string]interface{}

Source Files

bind.go clickhouse.go clickhouse_options.go clickhouse_rows.go clickhouse_rows_column_type.go clickhouse_std.go conn.go conn_async_insert.go conn_batch.go conn_check_dummy.go conn_exec.go conn_handshake.go conn_logs.go conn_ping.go conn_process.go conn_profile_events.go conn_query.go conn_send_query.go context.go scan.go struct_map.go

Directories

PathSynopsis
benchmark
benchmark/v1
benchmark/v1/read
benchmark/v1/write
benchmark/v2
benchmark/v2/read
benchmark/v2/read-native
benchmark/v2/write
benchmark/v2/write-async
benchmark/v2/write-async-std
benchmark/v2/write-native
benchmark/v2/write-native-columnar
benchmark/v2/write-native-struct
contributors
examples
examples/native
examples/native/batch
examples/native/bind
examples/native/dynamic-scan-types
examples/native/scan_struct
examples/native/simple
examples/native/write-async
examples/native/write-columnar
examples/native/write-struct
examples/std
examples/std/batch
examples/std/bind
examples/std/open_db
examples/std/simple
examples/std/write-async
external
lib
lib/binary
lib/cityhash102* COPY from https://github.com/zentures/cityhash/
lib/column
lib/column/codegen
lib/compress
lib/driver
lib/io
lib/proto
lib/timezone
tests
tests/issues
tests/issues/209
tests/issues/360
tests/issues/470
tests/issues/476
tests/issues/484
tests/issues/485
tests/std
tests/stress
Version
v2.0.8
Published
Feb 5, 2022
Platform
js/wasm
Imports
26 packages
Last checked
now

Tools for package owners.