pool

package
v0.0.0-...-02b4230 Latest Latest
Warning

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

Go to latest
Published: Sep 10, 2020 License: Apache-2.0 Imports: 4 Imported by: 0

Documentation

Overview

*

*
* @author liangjf
* @create on 2020/6/8
* @version 1.0

*

*
* @author liangjf
* @create on 2020/6/8
* @version 1.0

*

*
* @author liangjf
* @create on 2020/6/8
* @version 1.0

*

*
* @author liangjf
* @create on 2020/6/8
* @version 1.0

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrPoolParam       = errors.New("param is error")
	ErrPoolBilderNil   = errors.New("builder is nil")
	ErrPoolBuilder     = errors.New("pool builder is error")
	ErrPoolConnIsNil   = errors.New("pool conn is nil")
	ErrPoolBuilderConn = errors.New("pool builder conn error")
	ErrPoolNoIdeConn   = errors.New("pool no ide conn")
)
View Source
var (
	ErrNetHadClosed = errors.New("net had closed")
)

Functions

This section is empty.

Types

type Builder

type Builder func(context.Context) (net.Conn, error)

type IPool

type IPool interface {
	Get() (net.Conn, error)
	Close()
}

IPool 连接池管理接口

func NewPool

func NewPool(opts ...Option) (IPool, error)

type Option

type Option func(*Options)

func WithBuilder

func WithBuilder(builder Builder) Option

func WithInitCap

func WithInitCap(initCap int) Option

func WithMaxCap

func WithMaxCap(maxCap int) Option

func WithMaxIdle

func WithMaxIdle(maxIdle int) Option

type Options

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

Jump to

Keyboard shortcuts

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