Documentation
¶
Overview ¶
Package database declaring ClickHouse Cluster and Shard interface.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Cluster ¶
type Cluster interface {
// Shards returns shards for rollup.
Shards(ctx context.Context) ([]Shard, error)
}
Cluster ...
type QueryError ¶
type QueryError struct {
Type QueryErrorType
Inner error
}
QueryError is needed because different drivers return different types of errors. This type allows the 'rollup' package to understand errors from the driver. You must be sure to wrap the driver error in the Shard, Row, Rows methods into QueryError. Check example for 'clickhouse-go' driver at the github.com/ozontech/ch-rollup/pkg/database/error_wrappers/clickhouse_go.Wrap
func (QueryError) Error ¶
func (e QueryError) Error() string
func (QueryError) Unwrap ¶
func (e QueryError) Unwrap() error
type QueryErrorType ¶
type QueryErrorType uint8
QueryErrorType ...
const ( // ErrUnknownTable means that the table has not been created. // Equivalent to ClickHouse server error code 60. ErrUnknownTable QueryErrorType = iota + 1 // ErrTableAlreadyExists means that the table already exists. // Equivalent to ClickHouse server error code 57. ErrTableAlreadyExists )
func QueryErrorTypeString ¶
func QueryErrorTypeString(s string) (QueryErrorType, error)
QueryErrorTypeString retrieves an enum value from the enum constants string name. Throws an error if the param is not part of the enum.
func QueryErrorTypeValues ¶
func QueryErrorTypeValues() []QueryErrorType
QueryErrorTypeValues returns all values of the enum
func (QueryErrorType) IsAQueryErrorType ¶
func (i QueryErrorType) IsAQueryErrorType() bool
IsAQueryErrorType returns "true" if the value is listed in the enum definition. "false" otherwise
func (QueryErrorType) String ¶
func (i QueryErrorType) String() string
type Shard ¶
type Shard interface {
Name() string
Exec(ctx context.Context, query string, args ...any) error
Query(ctx context.Context, query string, args ...any) (Rows, error)
QueryRow(ctx context.Context, query string, args ...any) Row
}
Shard is an interface that declares methods that 'rollup' package use. You must implement QueryError for all returning errors from its methods.
Directories
¶
| Path | Synopsis |
|---|---|
|
error_wrappers
|
|
|
clickhouse_go
Package clickhouse_go implements error wrapper for 'clickhouse-go'.
|
Package clickhouse_go implements error wrapper for 'clickhouse-go'. |
|
common
Package common implements common error wrapper, that can be used by others.
|
Package common implements common error wrapper, that can be used by others. |
|
Package mock is a generated GoMock package.
|
Package mock is a generated GoMock package. |
|
Package static implements connect to static Clickhouse node or cluster.
|
Package static implements connect to static Clickhouse node or cluster. |