package chpool
import "github.com/ClickHouse/ch-go/chpool"
Package chpool is a connection pool for ch.
Index ¶
- Constants
- type Client
- func (c *Client) Do(ctx context.Context, q ch.Query) (err error)
- func (c *Client) Ping(ctx context.Context) error
- func (c *Client) Release()
- type Options
- type Pool
- func Dial(ctx context.Context, opt Options) (*Pool, error)
- func New(ctx context.Context, opt Options) (*Pool, error)
- func (p *Pool) Acquire(ctx context.Context) (*Client, error)
- func (p *Pool) Close()
- func (p *Pool) Do(ctx context.Context, q ch.Query) (err error)
- func (p *Pool) Ping(ctx context.Context) error
- func (p *Pool) Stat() *puddle.Stat
Constants ¶
const ( DefaultMaxConnLifetime = time.Hour DefaultMaxConnIdleTime = time.Minute * 30 DefaultHealthCheckPeriod = time.Minute )
Defaults for pool.
Types ¶
type Client ¶
type Client struct {
// contains filtered or unexported fields
}
Client is an acquired *ch.Client from a Pool.
func (*Client) Do ¶
func (*Client) Ping ¶
func (*Client) Release ¶
func (c *Client) Release()
Release returns client to the pool.
type Options ¶
type Options struct { ClientOptions ch.Options MaxConnLifetime time.Duration MaxConnIdleTime time.Duration MaxConns int32 MinConns int32 HealthCheckPeriod time.Duration }
Options for Pool.
type Pool ¶
type Pool struct {
// contains filtered or unexported fields
}
Pool of connections to ClickHouse.
func Dial ¶
Dial returns a pool of connections to ClickHouse. Checks if ClickHouse is available, fails if not.
func New ¶
New returns a pool of connections to ClickHouse.
func (*Pool) Acquire ¶
Acquire connection from pool.
func (*Pool) Close ¶
func (p *Pool) Close()
Close pool.
func (*Pool) Do ¶
func (*Pool) Ping ¶
func (*Pool) Stat ¶
func (p *Pool) Stat() *puddle.Stat
Stat return pool statistic.
Source Files ¶
client.go conn.go doc.go pool.go
- Version
- v0.62.0
- Published
- Jul 1, 2024
- Platform
- darwin/amd64
- Imports
- 6 packages
- Last checked
- 1 minute ago –
Tools for package owners.