Documentation ¶
Index ¶
- func DropHost(host string)
- type Cluster
- type ClusterConnectionParams
- type ClusterCredentials
- type Connection
- func (c *Connection) Exec(_ctx context.Context, sql string, opts *QueryOptions) error
- func (c *Connection) Params() *EndpointConnectionParams
- func (c *Connection) Query(sql string) (*QueryResult, error)
- func (c *Connection) QueryContext(ctx context.Context, sql string) (*QueryResult, error)
- func (c *Connection) SetLog(l log.Announcer) *Connection
- type EndpointConnectionParams
- type EndpointCredentials
- type QueryOptions
- type QueryResult
- type Timeouts
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type Cluster ¶
type Cluster struct { *ClusterConnectionParams Hosts []string // contains filtered or unexported fields }
Cluster specifies clickhouse cluster object
func (*Cluster) ExecAll ¶
ExecAll runs set of SQL queries on all endpoints of the cluster. No data is expected to be returned back. Retry logic traverses the list of SQLs multiple times until all SQLs succeed.
type ClusterConnectionParams ¶
type ClusterConnectionParams struct { *ClusterCredentials *Timeouts }
ClusterConnectionParams represents connection parameters to the whole cluster
func NewClusterConnectionParams ¶
func NewClusterConnectionParams(scheme, username, password, rootCA string, port int) *ClusterConnectionParams
NewClusterConnectionParams creates new ClusterConnectionParams
func NewClusterConnectionParamsFromCHOpConfig ¶
func NewClusterConnectionParamsFromCHOpConfig(config *api.OperatorConfig) *ClusterConnectionParams
NewClusterConnectionParamsFromCHOpConfig is the same as NewClusterConnectionParams, but works with CHOp config to get parameters from
func (*ClusterConnectionParams) NewEndpointConnectionParams ¶
func (p *ClusterConnectionParams) NewEndpointConnectionParams(host string) *EndpointConnectionParams
NewEndpointConnectionParams creates endpoint connection params for a specified host in the cluster
func (*ClusterConnectionParams) SetTimeouts ¶
func (p *ClusterConnectionParams) SetTimeouts(timeouts *Timeouts) *ClusterConnectionParams
SetTimeouts sets timeout
type ClusterCredentials ¶
type ClusterCredentials struct { Scheme string Username string Password string RootCA string Port int }
ClusterCredentials specifies cluster endpoint credentials
func NewClusterCredentials ¶
func NewClusterCredentials(scheme, username, password, rootCA string, port int) *ClusterCredentials
NewClusterCredentials creates new ClusterCredentials
type Connection ¶
type Connection struct {
// contains filtered or unexported fields
}
Connection specifies clickhouse database connection object
func GetPooledDBConnection ¶
func GetPooledDBConnection(params *EndpointConnectionParams) *Connection
GetPooledDBConnection gets connection out of the pool. In case no connection available new connection is created and returned.
func NewConnection ¶
func NewConnection(params *EndpointConnectionParams) *Connection
NewConnection creates new clickhouse connection
func (*Connection) Exec ¶
func (c *Connection) Exec(_ctx context.Context, sql string, opts *QueryOptions) error
Exec runs given sql query
func (*Connection) Params ¶
func (c *Connection) Params() *EndpointConnectionParams
Params gets connection params
func (*Connection) Query ¶
func (c *Connection) Query(sql string) (*QueryResult, error)
Query runs given sql query
func (*Connection) QueryContext ¶
func (c *Connection) QueryContext(ctx context.Context, sql string) (*QueryResult, error)
QueryContext runs given sql query on behalf of specified context
func (*Connection) SetLog ¶
func (c *Connection) SetLog(l log.Announcer) *Connection
SetLog sets log announcer
type EndpointConnectionParams ¶
type EndpointConnectionParams struct { *EndpointCredentials *Timeouts }
EndpointConnectionParams represents connection parameters
func NewEndpointConnectionParams ¶
func NewEndpointConnectionParams(scheme, hostname, username, password, rootCA string, port int) *EndpointConnectionParams
NewEndpointConnectionParams creates new EndpointConnectionParams
func (*EndpointConnectionParams) SetTimeouts ¶
func (p *EndpointConnectionParams) SetTimeouts(timeouts *Timeouts) *EndpointConnectionParams
SetTimeouts sets timeout
type EndpointCredentials ¶
type EndpointCredentials struct {
// contains filtered or unexported fields
}
EndpointCredentials specifies credentials to access specified endpoint
func NewEndpointCredentials ¶
func NewEndpointCredentials(scheme, hostname, username, password, rootCA string, port int) *EndpointCredentials
NewEndpointCredentials creates new EndpointCredentials object
func (*EndpointCredentials) GetDSNWithHiddenCredentials ¶
func (c *EndpointCredentials) GetDSNWithHiddenCredentials() string
GetDSNWithHiddenCredentials gets DSN with hidden sensitive info
type QueryOptions ¶
QueryOptions specifies options of a query
func NewQueryOptions ¶
func NewQueryOptions() *QueryOptions
NewQueryOptions creates new query options
func QueryOptionsNormalize ¶
func QueryOptionsNormalize(opts ...*QueryOptions) *QueryOptions
QueryOptionsNormalize normalizes options
func (*QueryOptions) GetSilent ¶
func (o *QueryOptions) GetSilent() bool
GetSilent gets silent option
func (*QueryOptions) Normalize ¶
func (o *QueryOptions) Normalize() *QueryOptions
Normalize normalizes options
func (*QueryOptions) SetRetry ¶
func (o *QueryOptions) SetRetry(retry bool) *QueryOptions
SetRetry sets retry option
func (*QueryOptions) SetSilent ¶
func (o *QueryOptions) SetSilent(silent bool) *QueryOptions
SetSilent sets silent option
type QueryResult ¶
type QueryResult struct { // Query result rows Rows *databasesql.Rows // contains filtered or unexported fields }
QueryResult specifies result of a query
func NewQueryResult ¶
func NewQueryResult(ctx context.Context, cancelFunc context.CancelFunc, rows *databasesql.Rows) *QueryResult
NewQueryResult creates new query result
func (*QueryResult) Close ¶
func (q *QueryResult) Close()
Close closes query result and releases all allocated resources. Should be called on each query result
func (*QueryResult) Int ¶
func (q *QueryResult) Int() (int, error)
Int fetches one int from the query result
func (*QueryResult) String ¶
func (q *QueryResult) String() (string, error)
String fetches one string from the query result
func (*QueryResult) UnzipColumnsAsStrings ¶
func (q *QueryResult) UnzipColumnsAsStrings(columns ...*[]string) error
UnzipColumnsAsStrings splits result table into string columns
type Timeouts ¶
type Timeouts struct {
// contains filtered or unexported fields
}
Timeouts specifies set of timeouts for a clickhouse connection
func NewTimeouts ¶
NewTimeouts creates new set of timeouts
func (*Timeouts) GetConnectTimeout ¶
GetConnectTimeout gets connect timeout
func (*Timeouts) GetQueryTimeout ¶
GetQueryTimeout gets query timeout
func (*Timeouts) SetConnectTimeout ¶
SetConnectTimeout sets connect timeout