Documentation ¶
Index ¶
- func DropHost(host string)
- type Cluster
- func (c *Cluster) ExecAll(ctx context.Context, queries []string, _opts ...*QueryOptions) error
- func (c *Cluster) QueryAny(ctx context.Context, sql string) (*QueryResult, error)
- func (c *Cluster) SetEndpointCredentials(endpointCredentials *ClusterEndpointCredentials) *Cluster
- func (c *Cluster) SetHosts(hosts []string) *Cluster
- func (c *Cluster) SetLog(a log.Announcer) *Cluster
- type ClusterEndpointCredentials
- type Connection
- func (c *Connection) Exec(_ctx context.Context, sql string, opts *QueryOptions) error
- func (c *Connection) Params() *ConnectionParams
- 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 ConnectionParams
- type EndpointCredentials
- type QueryOptions
- type QueryResult
- type TimeLimitedConnector
- type Timeouts
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type Cluster ¶
type Cluster struct { *ClusterEndpointCredentials 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.
func (*Cluster) QueryAny ¶
QueryAny walks over all endpoints and runs query sequentially on each of them. In case endpoint returned result, walk is completed and result is returned. In case endpoint failed, continue with the next endpoint.
func (*Cluster) SetEndpointCredentials ¶
func (c *Cluster) SetEndpointCredentials(endpointCredentials *ClusterEndpointCredentials) *Cluster
SetEndpointCredentials sets endpoint credentials
type ClusterEndpointCredentials ¶
ClusterEndpointCredentials specifies cluster endpoint credentials
type Connection ¶
type Connection struct {
// contains filtered or unexported fields
}
Connection specifies clickhouse database connection object
func GetPooledDBConnection ¶
func GetPooledDBConnection(params *ConnectionParams) *Connection
GetPooledDBConnection gets connection out of the pool. In case no connection available new connection is created and returned.
func NewConnection ¶
func NewConnection(params *ConnectionParams) *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() *ConnectionParams
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 ConnectionParams ¶
type ConnectionParams struct { *EndpointCredentials *Timeouts }
ConnectionParams represents connection parameters
func NewConnectionParams ¶
func NewConnectionParams(scheme, hostname, username, password string, port int) *ConnectionParams
NewConnectionParams creates new ConnectionParams
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 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) UnzipColumnsAsStrings ¶
func (q *QueryResult) UnzipColumnsAsStrings(columns ...*[]string) error
UnzipColumnsAsStrings splits result table into string columns
type TimeLimitedConnector ¶
type TimeLimitedConnector interface { GetConnectTimeout() time.Duration SetConnectTimeout(timeout time.Duration) GetQueryTimeout() time.Duration SetQueryTimeout(timeout time.Duration) }
TimeLimitedConnector specifies interface to operate with timeouts on connection
type Timeouts ¶
type Timeouts struct {
// contains filtered or unexported fields
}
Timeouts specifies set of timeouts for a clickhouse connection
func (*Timeouts) GetConnectTimeout ¶
GetConnectTimeout gets connect timeout
func (*Timeouts) GetQueryTimeout ¶
GetQueryTimeout gets query timeout
func (*Timeouts) SetConnectTimeout ¶
SetConnectTimeout sets connect timeout
func (*Timeouts) SetQueryTimeout ¶
SetQueryTimeout sets query timeout