func (pc *PoolConn) PrepareContext(ctx context.Context, command string) (middleware.Statement, error) {
	return pc.prepare()
}
PrepareContext prepares a statement with context and returns a *Statement
package prometheus
import (
	"context"
	"errors"
	"fmt"
	"net/http"
	"sync"
	"time"
	"github.com/hashicorp/go-multierror"
	"github.com/romberli/log"
	"github.com/romberli/go-util/constant"
	"github.com/romberli/go-util/middleware"
)
const (
	DefaultMaxConnections     = 20
	DefaultInitConnections    = 5
	DefaultMaxIdleConnections = 10
	DefaultMaxIdleTime        = 1800  
	DefaultKeepAliveInterval  = 300   
	DefaultKeepAliveChunkSize = 5
	DefaultSleepTime          = 1  
)
var _ middleware.PoolConn = (*PoolConn)(nil)
var _ middleware.Pool = (*Pool)(nil)
type PoolConfig struct {
	Config
	MaxConnections     int
	InitConnections    int
	MaxIdleConnections int
	MaxIdleTime        int
	KeepAliveInterval  int
}
func NewPoolConfig(addr string, rt http.RoundTripper, maxConnections, initConnections, maxIdleConnections, maxIdleTime, keepAliveInterval int) PoolConfig {
	return PoolConfig{
		Config:             NewConfig(addr, rt),
		MaxConnections:     maxConnections,
		InitConnections:    initConnections,
		MaxIdleConnections: maxIdleConnections,
		MaxIdleTime:        maxIdleTime,
		KeepAliveInterval:  keepAliveInterval,
	}
}
func NewPoolConfigWithConfig(config Config, maxConnections, initConnections, maxIdleConnections, maxIdleTime, keepAliveInterval int) PoolConfig {
	return PoolConfig{
		Config:             config,
		MaxConnections:     maxConnections,
		InitConnections:    initConnections,
		MaxIdleConnections: maxIdleConnections,
		MaxIdleTime:        maxIdleTime,
		KeepAliveInterval:  keepAliveInterval,
	}
}
func (cfg *PoolConfig) Validate() (bool, error) {
	if cfg.MaxConnections <= constant.ZeroInt {
		return false, errors.New("maximum connection argument should larger than 0")
	}
	if cfg.InitConnections < constant.ZeroInt {
		return false, errors.New("init connection argument should not be smaller than 0")
	}
	if cfg.MaxIdleConnections < constant.ZeroInt {
		return false, errors.New("maximum idle connection argument should not be smaller than 0")
	}
	if cfg.MaxIdleConnections > cfg.MaxConnections {
		return false, errors.New("maximum idle connection argument should not be larger than maximum connection argument")
	}
	if cfg.MaxIdleTime <= constant.ZeroInt {
		return false, errors.New("maximum idle time argument should be larger than 0")
	}
	if cfg.KeepAliveInterval <= constant.ZeroInt {
		return false, errors.New("keep alive interval argument should be larger than 0")
	}
	return true, nil
}
type PoolConn struct {
	*Conn
	Pool *Pool
}
func NewPoolConn(addr string, rt http.RoundTripper) (*PoolConn, error) {
	conn, err := NewConn(addr, rt)
	if err != nil {
		return nil, err
	}
	return &PoolConn{
		Conn: conn,
		Pool: nil,
	}, nil
}
func NewPoolConnWithPool(pool *Pool, addr string, rt http.RoundTripper) (*PoolConn, error) {
	pc, err := NewPoolConn(addr, rt)
	if err != nil {
		return nil, err
	}
	if pc.IsValid() {
		pc.Pool = pool
		return pc, nil
	}
	_ = pc.Disconnect()
	return nil, errors.New("new created connection is not valid")
}
func (pc *PoolConn) Close() error {
	if pc.Pool.isClosed == true || pc.Pool == nil {
		return pc.Disconnect()
	}
	pc.Pool.Lock()
	defer pc.Pool.Unlock()
	pc.Pool.put(pc)
	return nil
}
func (pc *PoolConn) Disconnect() error {
	pc.Pool = nil
	return nil
}
func (pc *PoolConn) IsValid() bool {
	return pc.CheckInstanceStatus()
}
func (pc *PoolConn) Prepare(command string) (middleware.Statement, error) {
	return pc.prepare()
}