Documentation ¶
Index ¶
- func BytesToFixedString(bytes []byte) string
- func FormatNumberArray[N PrintableType](n []N) string
- func FormatStringArray(n []string) string
- func FormatUUIDAsFixedString(id uuid.UUID) string
- func FormatUUIDsAsFixedStringArray(ids uuid.UUIDs) string
- func FuncMapToString(fName string, ids []string) (string, []any)
- func GetDatabaseConnection(clickHouseDSN string, opts *clickhouse.Options, logger *zap.Logger, ...) (clickhouse.Conn, error)
- type Conn
- type Identifier
- type Options
- type Parameters
- type PrintableType
- type QueryBuilder
- func (qb *QueryBuilder) Args() clickhouse.Parameters
- func (qb *QueryBuilder) Build(q string, elems ...any) *QueryBuilder
- func (qb *QueryBuilder) Context(ctx context.Context, options ...clickhouse.QueryOption) context.Context
- func (qb *QueryBuilder) SQL() string
- func (qb *QueryBuilder) WithParam(name string, value string) *QueryBuilder
- type TimestampNano
- type TypeValPair
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func BytesToFixedString ¶
BytesToFixedString converts a byte slice into a printable string that can be used as a ClickHouse FixedString(N) parameter.
func FormatNumberArray ¶
func FormatNumberArray[N PrintableType](n []N) string
func FormatStringArray ¶
FormatStringArray converts a slice of strings into a ClickHouse array literal. Strings are escaped with \ and '.
func FormatUUIDAsFixedString ¶
FormatUUIDAsFixedString converts a UUID into a printable string that can be used as a ClickHouse FixedString(16) parameter.
func FormatUUIDsAsFixedStringArray ¶
FormatUUIDsAsFixedStringArray converts a slice of UUIDs into a ClickHouse Array(FixedString(16)) compatible string.
Types ¶
type Identifier ¶
type Identifier string
type Options ¶
type Options = clickhouse.Options
Options alias for ClickHouse options for import convenience
type Parameters ¶
type Parameters = clickhouse.Parameters
Parameters is alias for clickhouse parameters.
type PrintableType ¶
type PrintableType interface { constraints.Integer | constraints.Float }
type QueryBuilder ¶
type QueryBuilder struct { Params clickhouse.Parameters // contains filtered or unexported fields }
QueryBuilder helps construct a ClickHouse SQL query. Do not copy a non-zero QueryBuilder. QueryBuilder is not thread-safe. Provides a fluent interface to construct the query.
func NewQueryBuilder ¶
func NewQueryBuilder() *QueryBuilder
func (*QueryBuilder) Args ¶
func (qb *QueryBuilder) Args() clickhouse.Parameters
func (*QueryBuilder) Build ¶
func (qb *QueryBuilder) Build(q string, elems ...any) *QueryBuilder
Build takes the given sql string replaces any ? with the equivalent indexed parameter and appends elems to the args slice.
func (*QueryBuilder) Context ¶
func (qb *QueryBuilder) Context(ctx context.Context, options ...clickhouse.QueryOption) context.Context
Context returns a context to use with the ClickHouse driver query. It adds the query parameters to the context by default.
func (*QueryBuilder) SQL ¶
func (qb *QueryBuilder) SQL() string
func (*QueryBuilder) WithParam ¶
func (qb *QueryBuilder) WithParam(name string, value string) *QueryBuilder
WithParam adds a named parameter to the Params map.
type TimestampNano ¶
type TimestampNano int64
type TypeValPair ¶
TypeValPair is a pair of (type, value) to use explicit parameter type and value.