Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type AsyncInsertConfig ¶
type AsyncInsertConfig struct {
// contains filtered or unexported fields
}
AsyncInsertConfig holds configuration for server-side asynchronous inserts.
type AsyncInsertOption ¶
type AsyncInsertOption func(c *AsyncInsertConfig)
AsyncInsertOption configures the async insert behavior.
func BusyTimeout ¶
func BusyTimeout(timeout int) AsyncInsertOption
BusyTimeout sets the max time in ms to wait before flush (e.g., 5000 = 5 seconds).
func MaxDataSize ¶
func MaxDataSize(size int) AsyncInsertOption
MaxDataSize sets the buffer size in bytes before flush (e.g., 10485760 = 10MB).
func WaitForInsert ¶
func WaitForInsert() AsyncInsertOption
WaitForInsert enables waiting for server-side flush, ensuring durability.
type Conn ¶
Conn represents connection to ClickHouse database.
func New ¶
New establishes connection with Clickhouse server. Returns a pointer to a new instance of Conn struct.
func (*Conn) MarkHealthy ¶
func (c *Conn) MarkHealthy()
func (*Conn) MarkUnhealthy ¶
type Option ¶
type Option func(options *clickhouse.Options)
Option configures the ClickHouse client options.
func WithAsyncInsert ¶
func WithAsyncInsert(opts ...AsyncInsertOption) Option
WithAsyncInsert enables asynchronous inserts on the server side. This reduces write IOPS by batching multiple insert operations on the ClickHouse server. Async inserts replace client-side batching — the server handles all buffering and flushing.
func WithConnectionPool ¶
WithConnectionPool configures the connection pool for high-concurrency scenarios. For high-throughput applications (1000+ concurrent requests), increase pool size accordingly. Recommended settings:
- maxOpenConns: Maximum number of open connections (e.g., 100-200 for high load)
- maxIdleConns: Maximum number of idle connections to keep (e.g., 50-100)