Help us shape the future of Go! Take the 2026 Go Developer Survey

pool

package
v0.72.1 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jul 26, 2026 License: Apache-2.0 Imports: 6 Imported by: 0

Documentation

Overview

Package chpool is a connection pool for ch.

Index

Constants

View Source
const (
	DefaultMaxConnLifetime   = time.Hour
	DefaultMaxConnIdleTime   = time.Minute * 30
	DefaultHealthCheckPeriod = time.Minute
)

Defaults for pool.

Variables

This section is empty.

Functions

This section is empty.

Types

type Client

type Client struct {
	// contains filtered or unexported fields
}

Client is an acquired *native.Client from a Pool.

func (*Client) Close

func (c *Client) Close() error

func (*Client) Do

func (c *Client) Do(ctx context.Context, q native.Query) (err error)

func (*Client) Ping

func (c *Client) Ping(ctx context.Context) error

func (*Client) Release

func (c *Client) Release()

Release returns client to the pool.

type Options

type Options struct {
	ClientOptions     native.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 Datastore.

func Dial

func Dial(ctx context.Context, opt Options) (*Pool, error)

Dial returns a pool of connections to Datastore. Checks if Datastore is available, fails if not.

func New

func New(ctx context.Context, opt Options) (*Pool, error)

New returns a pool of connections to Datastore.

func (*Pool) Acquire

func (p *Pool) Acquire(ctx context.Context) (*Client, error)

Acquire connection from pool.

func (*Pool) Close

func (p *Pool) Close()

Close pool.

func (*Pool) Do

func (p *Pool) Do(ctx context.Context, q native.Query) (err error)

func (*Pool) Ping

func (p *Pool) Ping(ctx context.Context) error

func (*Pool) Stat

func (p *Pool) Stat() *puddle.Stat

Stat return pool statistic.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL