Documentation ¶
Index ¶
- Constants
- Variables
- func Connector(opt *Options) driver.Connector
- func Context(parent context.Context, options ...QueryOption) context.Context
- func DateNamed(name string, value time.Time, scale TimeUnit) driver.NamedDateValue
- func Named(name string, value any) driver.NamedValue
- func Open(opt *Options) (driver.Conn, error)
- func OpenDB(opt *Options) *sql.DB
- type ArraySet
- type Auth
- type ClientInfo
- type Compression
- type CompressionMethod
- type Conn
- type ConnOpenStrategy
- type CustomSetting
- type Dial
- type DialResult
- type Exception
- type GroupSet
- type HTTPReaderWriter
- type Log
- type OpError
- type Options
- type Parameters
- type Pool
- type ProfileEvent
- type ProfileInfo
- type Progress
- type Protocol
- type QueryOption
- func WithBlockBufferSize(size uint8) QueryOption
- func WithExternalTable(t ...*ext.Table) QueryOption
- func WithLogs(fn func(*Log)) QueryOption
- func WithParameters(params Parameters) QueryOption
- func WithProfileEvents(fn func([]ProfileEvent)) QueryOption
- func WithProfileInfo(fn func(*ProfileInfo)) QueryOption
- func WithProgress(fn func(*Progress)) QueryOption
- func WithQueryID(queryID string) QueryOption
- func WithQuotaKey(quotaKey string) QueryOption
- func WithSettings(settings Settings) QueryOption
- func WithSpan(span trace.SpanContext) QueryOption
- func WithStdAsync(wait bool) QueryOption
- func WithUserLocation(location *time.Location) QueryOption
- type QueryOptions
- type ServerVersion
- type Settings
- type TimeUnit
Constants ¶
View Source
const ( CompressionNone = CompressionMethod(compress.None) CompressionLZ4 = CompressionMethod(compress.LZ4) CompressionZSTD = CompressionMethod(compress.ZSTD) CompressionGZIP = CompressionMethod(0x95) CompressionDeflate = CompressionMethod(0x96) CompressionBrotli = CompressionMethod(0x97) )
View Source
const ( ClientVersionMajor = 2 ClientVersionMinor = 27 ClientVersionPatch = 0 ClientTCPProtocolVersion = proto.DBMS_TCP_PROTOCOL_VERSION )
View Source
const ClientName = "clickhouse-go"
Variables ¶
View Source
var ( ErrBatchInvalid = errors.New("clickhouse: batch is invalid. check appended data is correct") ErrBatchAlreadySent = errors.New("clickhouse: batch has already been sent") ErrBatchNotSent = errors.New("clickhouse: invalid retry, batch not sent yet") 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") ErrBindMixedParamsFormats = errors.New("clickhouse [bind]: mixed named, numeric or positional parameters") ErrAcquireConnNoAddress = errors.New("clickhouse: no valid address supplied") ErrServerUnexpectedData = errors.New("code: 101, message: Unexpected packet Data received from client") )
View Source
var (
ErrExpectedStringValueInNamedValueForQueryParameter = errors.New("expected string value in NamedValue for query parameter")
)
Functions ¶
Types ¶
type ClientInfo ¶ added in v2.6.0
type ClientInfo struct { Products []struct { Name string Version string } // contains filtered or unexported fields }
func (ClientInfo) String ¶ added in v2.6.0
func (o ClientInfo) String() string
type Compression ¶
type Compression struct { Method CompressionMethod // this only applies to zlib and brotli compression algorithms Level int }
type CompressionMethod ¶ added in v2.3.0
type CompressionMethod byte
func (CompressionMethod) String ¶ added in v2.3.0
func (c CompressionMethod) String() string
type ConnOpenStrategy ¶
type ConnOpenStrategy uint8
const ( ConnOpenInOrder ConnOpenStrategy = iota ConnOpenRoundRobin ConnOpenRandom )
type CustomSetting ¶ added in v2.9.3
type CustomSetting struct {
Value string
}
CustomSetting is a helper struct to distinguish custom settings from important ones. For native protocol, is_important flag is set to value 0x02 (see https://github.com/ClickHouse/ClickHouse/blob/c873560fe7185f45eed56520ec7d033a7beb1551/src/Core/BaseSettings.h#L516-L521) Only string value is supported until formatting logic that exists in ClickHouse is implemented in clickhouse-go. (https://github.com/ClickHouse/ClickHouse/blob/master/src/Core/Field.cpp#L312 and https://github.com/ClickHouse/clickhouse-go/issues/992)
type DialResult ¶ added in v2.5.0
type DialResult struct {
// contains filtered or unexported fields
}
func DefaultDialStrategy ¶ added in v2.5.0
type HTTPReaderWriter ¶ added in v2.3.0
type HTTPReaderWriter struct {
// contains filtered or unexported fields
}
type Options ¶
type Options struct { Protocol Protocol ClientInfo ClientInfo TLS *tls.Config Addr []string Auth Auth DialContext func(ctx context.Context, addr string) (net.Conn, error) DialStrategy func(ctx context.Context, connID int, options *Options, dial Dial) (DialResult, error) Debug bool Debugf func(format string, v ...any) // only works when Debug is true Settings Settings Compression *Compression DialTimeout time.Duration // default 30 second MaxOpenConns int // default MaxIdleConns + 5 MaxIdleConns int // default 5 ConnMaxLifetime time.Duration // default 1 hour ConnOpenStrategy ConnOpenStrategy FreeBufOnConnRelease bool // drop preserved memory buffer after each query HttpHeaders map[string]string // set additional headers on HTTP requests HttpUrlPath string // set additional URL path for HTTP requests BlockBufferSize uint8 // default 2 - can be overwritten on query MaxCompressionBuffer int // default 10485760 - measured in bytes i.e. 10MiB ReadTimeout time.Duration // contains filtered or unexported fields }
type Parameters ¶ added in v2.5.0
type ProfileEvent ¶
type ProfileInfo ¶
type ProfileInfo = proto.ProfileInfo
type QueryOption ¶
type QueryOption func(*QueryOptions) error
func WithBlockBufferSize ¶ added in v2.4.0
func WithBlockBufferSize(size uint8) QueryOption
func WithExternalTable ¶
func WithExternalTable(t ...*ext.Table) QueryOption
func WithLogs ¶
func WithLogs(fn func(*Log)) QueryOption
func WithParameters ¶ added in v2.5.0
func WithParameters(params Parameters) 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
func WithUserLocation ¶ added in v2.7.0
func WithUserLocation(location *time.Location) QueryOption
type QueryOptions ¶
type QueryOptions struct {
// contains filtered or unexported fields
}
type ServerVersion ¶
type ServerVersion = proto.ServerHandshake
Source Files ¶
- batch.go
- bind.go
- clickhouse.go
- clickhouse_options.go
- clickhouse_rows.go
- clickhouse_rows_column_type.go
- clickhouse_std.go
- client_info.go
- conn.go
- conn_async_insert.go
- conn_batch.go
- conn_check.go
- conn_exec.go
- conn_handshake.go
- conn_http.go
- conn_http_async_insert.go
- conn_http_batch.go
- conn_http_exec.go
- conn_http_query.go
- conn_logs.go
- conn_ping.go
- conn_process.go
- conn_profile_events.go
- conn_query.go
- conn_send_query.go
- context.go
- context_watchdog.go
- query_parameters.go
- scan.go
- struct_map.go
Directories ¶
Path | Synopsis |
---|---|
benchmark
|
|
examples
|
|
internal
|
|
lib
|
|
cityhash102
* COPY from https://github.com/zentures/cityhash/
|
* COPY from https://github.com/zentures/cityhash/ |
Click to show internal directories.
Click to hide internal directories.