Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
View Source
var DefaultTimeout = 30 * time.Second
DefaultTimeout is the default timeout for Client.
Functions ¶
This section is empty.
Types ¶
type Client ¶
type Client struct { // Addr is clickhouse address to connect to. // // localhost:8123 is used by default. Addr string // FallbackAddr is a fallback clickhouse address that is used // if request to Addr fails. // // By default there is no fallback address. FallbackAddr string // User to use when connecting to clickhouse. // // User is `default` if not set. User string // Password to use when connecting to clickhouse. // // Password is empty if not set. Password string // Database to use. // // Database is `default` if not set. Database string // Whether to send requests over https. // // Requests are sent over http by default. UseHTTPS bool // Whether to request compressed responses from clickhouse. // // Response compression may reduce network usage. // // Response compression is disabled by default. CompressResponse bool // Timeout is the maximum duration for the query. // // DefaultTimeout is used by default. Timeout time.Duration // URLParams to add to URL before requesting clickhouse. // // For instance, // // Client.URLParams = []string{ // "default_format=Pretty", // "no_cache=1", // } URLParams []string }
Client is http client for clickhouse.
The client is optimized for SELECT queries.
Best used with github.com/Vertamedia/chproxy.
func (*Client) Do ¶
func (c *Client) Do(query string, f ReadRowsFunc) error
Do sends the given query to clickhouse and calls f for reading query results.
The maximum query duration is limited by Client.Timeout.
f may be nil if query result isn't needed.
type ReadRowsFunc ¶
ReadRowsFunc must read rows from r.
Click to show internal directories.
Click to hide internal directories.