Documentation ¶
Overview ¶
Package ch implements ClickHouse client.
Index ¶
- func CompressionStrings() []string
- func IsErr(err error, codes ...proto.Error) bool
- func IsException(err error) bool
- func ProfileEventTypeStrings() []string
- type Client
- type Compression
- type CorruptedDataErr
- type Exception
- type Log
- type Options
- type ProfileEvent
- type ProfileEventType
- type Query
- type Server
- type ServerConn
- type ServerOptions
- type Setting
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func CompressionStrings ¶
func CompressionStrings() []string
CompressionStrings returns a slice of all String values of the enum
func ProfileEventTypeStrings ¶ added in v0.5.0
func ProfileEventTypeStrings() []string
ProfileEventTypeStrings returns a slice of all String values of the enum
Types ¶
type Client ¶
type Client struct {
// contains filtered or unexported fields
}
Client implements ClickHouse binary protocol client on top of single TCP connection.
func Connect ¶
Connect performs handshake with ClickHouse server and initializes application level connection.
func Dial ¶
Dial dials requested address and establishes TCP connection to ClickHouse server, performing handshake.
func (*Client) Close ¶
Close closes underlying connection and frees all resources, rendering Client to unusable state.
type Compression ¶
type Compression byte
Compression setting.
Trade bandwidth for CPU.
const ( // CompressionDisabled disables compression. Lowest CPU overhead. CompressionDisabled Compression = iota // CompressionLZ4 enables LZ4 compression for data. Medium CPU overhead. CompressionLZ4 // CompressionZSTD enables ZStandard compression. High CPU overhead. CompressionZSTD // CompressionNone uses no compression but data has checksums. CompressionNone )
func CompressionString ¶
func CompressionString(s string) (Compression, error)
CompressionString retrieves an enum value from the enum constants string name. Throws an error if the param is not part of the enum.
func CompressionValues ¶
func CompressionValues() []Compression
CompressionValues returns all values of the enum
func (Compression) IsACompression ¶
func (i Compression) IsACompression() bool
IsACompression returns "true" if the value is listed in the enum definition. "false" otherwise
func (Compression) String ¶
func (i Compression) String() string
type CorruptedDataErr ¶ added in v0.5.0
CorruptedDataErr means that provided hash mismatch with calculated.
func (*CorruptedDataErr) Error ¶ added in v0.5.0
func (c *CorruptedDataErr) Error() string
type Exception ¶
type Exception struct { Code proto.Error Name string Message string Stack string Next []Exception // non-nil only for top exception }
Exception is server-side error.
func AsException ¶
AsException finds first *Exception in err chain.
type Log ¶ added in v0.4.0
type Log struct { Time time.Time Host string QueryID string ThreadID uint64 Priority int8 Source string Text string }
Log from server.
type Options ¶
type Options struct { Logger *zap.Logger Database string User string Password string Settings []Setting Compression Compression }
Options for Client.
type ProfileEvent ¶ added in v0.5.0
type ProfileEvent struct { ThreadID uint64 Host string Time time.Time Type ProfileEventType Name string Value int64 }
ProfileEvent is detailed profiling event from Server.
type ProfileEventType ¶ added in v0.5.0
type ProfileEventType byte
const ( ProfileIncrement ProfileEventType = 1 ProfileGauge ProfileEventType = 2 )
func ProfileEventTypeString ¶ added in v0.5.0
func ProfileEventTypeString(s string) (ProfileEventType, error)
ProfileEventTypeString retrieves an enum value from the enum constants string name. Throws an error if the param is not part of the enum.
func ProfileEventTypeValues ¶ added in v0.5.0
func ProfileEventTypeValues() []ProfileEventType
ProfileEventTypeValues returns all values of the enum
func (ProfileEventType) IsAProfileEventType ¶ added in v0.5.0
func (i ProfileEventType) IsAProfileEventType() bool
IsAProfileEventType returns "true" if the value is listed in the enum definition. "false" otherwise
func (ProfileEventType) String ¶ added in v0.5.0
func (i ProfileEventType) String() string
type Query ¶
type Query struct { // Body of query, like "SELECT 1". Body string // QueryID is ID of query, defaults to new UUIDv4. QueryID string // QuotaKey of query, optional. QuotaKey string // Input columns for INSERT operations. Input []proto.InputColumn // OnInput is called to allow ingesting more data to Input. // // The io.EOF reports that no more input should be ingested. // // Optional, single block is ingested from Input if not provided, // but query will fail if Input is set but has zero rows. OnInput func(ctx context.Context) error // Result columns for SELECT operations. Result proto.Result // OnResult is called when Result is filled with result block. // // Optional, but query will fail of more than one block is received // and no OnResult is provided. OnResult func(ctx context.Context, block proto.Block) error // OnProgress is optional progress handler. The progress value contain // difference, so progress should be accumulated if needed. OnProgress func(ctx context.Context, p proto.Progress) error // OnProfile is optional handler for profiling data. OnProfile func(ctx context.Context, p proto.Profile) error // OnProfileEvent is optional handler for profiling event stream data. OnProfileEvent func(ctx context.Context, e ProfileEvent) error // OnLog is optional handler for server log entry. OnLog func(ctx context.Context, l Log) error // Settings are optional query-scoped settings. Can override client settings. Settings []Setting // ExternalData is optional data for server to load. // // https://clickhouse.com/docs/en/engines/table-engines/special/external-data/ ExternalData []proto.InputColumn // ExternalTable name. Defaults to _data. ExternalTable string }
Query to ClickHouse.
type Server ¶ added in v0.4.0
type Server struct {
// contains filtered or unexported fields
}
Server is basic ClickHouse server.
func NewServer ¶ added in v0.4.0
func NewServer(opt ServerOptions) *Server
NewServer returns new ClickHouse Server.
type ServerConn ¶ added in v0.4.0
type ServerConn struct {
// contains filtered or unexported fields
}
ServerConn wraps Server connection.
type ServerOptions ¶ added in v0.4.0
ServerOptions wraps possible Server configuration.
Source Files ¶
Directories ¶
Path | Synopsis |
---|---|
internal
|
|
cht
Package cht implements ClickHouse testing utilities, primarily end to end.
|
Package cht implements ClickHouse testing utilities, primarily end to end. |
compress
Package compress implements compression support.
|
Package compress implements compression support. |
e2e
Package e2e implements end to end testing utilities.
|
Package e2e implements end to end testing utilities. |
gold
Package gold implements golden files.
|
Package gold implements golden files. |
Package proto implements ClickHouse wire protocol.
|
Package proto implements ClickHouse wire protocol. |