Documentation ¶
Index ¶
- Variables
- func ErrWrapper(err Err, ps ...string) error
- type Config
- type Err
- type ExclusivePool
- type OptionFunc
- func WithAddress(Address string) OptionFunc
- func WithBestPoolSize(BestPoolSize int) OptionFunc
- func WithCleanInterval(CleanInterval time.Duration) OptionFunc
- func WithClose(Close func(ctx context.Context, connection interface{}) (err error)) OptionFunc
- func WithCreateNewInterval(CreateNewInterval time.Duration) OptionFunc
- func WithDial(...) OptionFunc
- func WithDialRetryCount(DialRetryCount int) OptionFunc
- func WithDialRetryInterval(DialRetryInterval time.Duration) OptionFunc
- func WithInitialPoolSize(InitialPoolSize int) OptionFunc
- func WithKeepAlive(KeepAlive func(ctx context.Context, connection interface{}) (err error)) OptionFunc
- func WithKeepAliveInterval(KeepAliveInterval time.Duration) OptionFunc
- func WithLogger(Logger log.Log) OptionFunc
- func WithMaxPoolSize(MaxPoolSize int) OptionFunc
- func WithPort(Port string) OptionFunc
- func WithType(poolType Type) OptionFunc
- type Pool
- type SharePool
- type Type
Constants ¶
This section is empty.
Variables ¶
Functions ¶
func ErrWrapper ¶
Types ¶
type Config ¶ added in v0.0.52
type Config struct { PoolType Type Address string Port string Dial func(ctx context.Context, address, port string) (connection interface{}, err error) Close func(ctx context.Context, connection interface{}) (err error) KeepAlive func(ctx context.Context, connection interface{}) (err error) InitialPoolSize int BestPoolSize int MaxPoolSize int DialRetryCount int KeepAliveInterval time.Duration CleanInterval time.Duration DialRetryInterval time.Duration CreateNewInterval time.Duration Logger log.Log }
type ExclusivePool ¶
type ExclusivePool struct { Address string Port string Dial func(ctx context.Context, address, port string) (connection interface{}, err error) Close func(ctx context.Context, connection interface{}) (err error) KeepAlive func(ctx context.Context, connection interface{}) (err error) InitialPoolSize int BestPoolSize int MaxPoolSize int DialRetryCount int KeepAliveInterval time.Duration CleanInterval time.Duration DialRetryInterval time.Duration Logger log.Log // contains filtered or unexported fields }
func NewExclusivePool ¶
func NewExclusivePool(ctx context.Context, cfg *Config) (*ExclusivePool, error)
func (*ExclusivePool) Get ¶
func (p *ExclusivePool) Get() (connection interface{}, err error)
func (*ExclusivePool) Put ¶
func (p *ExclusivePool) Put(connection interface{}) (err error)
func (*ExclusivePool) Release ¶
func (p *ExclusivePool) Release()
type OptionFunc ¶
type OptionFunc func(*Config)
func WithAddress ¶
func WithAddress(Address string) OptionFunc
func WithBestPoolSize ¶
func WithBestPoolSize(BestPoolSize int) OptionFunc
func WithCleanInterval ¶
func WithCleanInterval(CleanInterval time.Duration) OptionFunc
func WithClose ¶
func WithClose(Close func(ctx context.Context, connection interface{}) (err error)) OptionFunc
func WithCreateNewInterval ¶
func WithCreateNewInterval(CreateNewInterval time.Duration) OptionFunc
func WithDial ¶
func WithDial(Dial func(ctx context.Context, address, port string) (connection interface{}, err error)) OptionFunc
func WithDialRetryCount ¶
func WithDialRetryCount(DialRetryCount int) OptionFunc
func WithDialRetryInterval ¶
func WithDialRetryInterval(DialRetryInterval time.Duration) OptionFunc
func WithInitialPoolSize ¶
func WithInitialPoolSize(InitialPoolSize int) OptionFunc
func WithKeepAlive ¶
func WithKeepAlive(KeepAlive func(ctx context.Context, connection interface{}) (err error)) OptionFunc
func WithKeepAliveInterval ¶
func WithKeepAliveInterval(KeepAliveInterval time.Duration) OptionFunc
func WithLogger ¶
func WithLogger(Logger log.Log) OptionFunc
func WithMaxPoolSize ¶
func WithMaxPoolSize(MaxPoolSize int) OptionFunc
func WithPort ¶
func WithPort(Port string) OptionFunc
func WithType ¶
func WithType(poolType Type) OptionFunc
type Pool ¶
Click to show internal directories.
Click to hide internal directories.