Documentation ¶
Index ¶
- Constants
- Variables
- func Array(v interface{}) driver.Valuer
- func Date(t time.Time) driver.Valuer
- func Decimal128(v interface{}, s int32) driver.Valuer
- func Decimal32(v interface{}, s int32) driver.Valuer
- func Decimal64(v interface{}, s int32) driver.Valuer
- func DeregisterTLSConfig(key string)
- func RegisterTLSConfig(key string, config *tls.Config) error
- func UInt64(u uint64) driver.Valuer
- type Config
- type DataParser
- type DataParserOptions
- type Error
- type TypeDesc
Constants ¶
const ( // QueryID uses for setting query_id request param for request to Clickhouse QueryID key = iota // QuotaKey uses for setting quota_key request param for request to Clickhouse QuotaKey )
Variables ¶
var ( ErrPlaceholderCount = errors.New("clickhouse: wrong placeholder count") ErrNameParams = errors.New("clickhouse: driver does not support the use of Named Parameters") ErrMalformed = errors.New("clickhouse: response is malformed") ErrTransportNil = errors.New("clickhouse: transport must be set") ErrIncorrectResponse = errors.New("clickhouse: response must contain 'Ok.'") ErrNoLastInsertID = errors.New("no LastInsertId available") ErrNoRowsAffected = errors.New("no RowsAffected available") )
Various errors the driver might return. Can change between driver versions.
Functions ¶
func Array ¶
Array wraps slice or array into driver.Valuer interface to allow pass through it from database/sql
func Decimal128 ¶
Decimal128 converts value to Decimal128 of precision S. The value can be a number or a string. The S (scale) parameter specifies the number of decimal places.
func Decimal32 ¶
Decimal32 converts value to Decimal32 of precision S. The value can be a number or a string. The S (scale) parameter specifies the number of decimal places.
func Decimal64 ¶
Decimal64 converts value to Decimal64 of precision S. The value can be a number or a string. The S (scale) parameter specifies the number of decimal places.
func DeregisterTLSConfig ¶
func DeregisterTLSConfig(key string)
DeregisterTLSConfig removes the tls.Config associated with key.
func RegisterTLSConfig ¶
RegisterTLSConfig registers a custom tls.Config to be used with sql.Open.
Types ¶
type Config ¶
type Config struct { User string Password string Scheme string Host string Database string Timeout time.Duration IdleTimeout time.Duration ReadTimeout time.Duration WriteTimeout time.Duration Location *time.Location Debug bool UseDBLocation bool GzipCompression bool Params map[string]string TLSConfig string KillQueryOnErr bool // kill query on the server side if we have error from transport KillQueryTimeout time.Duration }
Config is a configuration parsed from a DSN string
type DataParser ¶
DataParser implements parsing of a driver value and reporting its type.
func NewDataParser ¶
func NewDataParser(t *TypeDesc, opt *DataParserOptions) (DataParser, error)
NewDataParser creates a new DataParser based on the given TypeDesc.
type DataParserOptions ¶
type DataParserOptions struct { // Location describes default location for DateTime and Date field without Timezone argument. Location *time.Location // UseDBLocation if false: always use Location, ignore DateTime argument. UseDBLocation bool }
DataParserOptions describes DataParser options. Ex.: Fields Location and UseDBLocation specify timezone options.
type TypeDesc ¶
TypeDesc describes a (possibly nested) data type returned by ClickHouse.
func ParseTypeDesc ¶
ParseTypeDesc parses the type description that ClickHouse provides.
The grammar is quite simple:
desc name name() name(args) args desc desc, args
Examples:
String Nullable(Nothing) Array(Tuple(Tuple(String, String), Tuple(String, UInt64)))