gitee.com/quant1x/gox@v1.21.2/pool/pool.go (about) 1 package pool 2 3 import "errors" 4 5 var ( 6 //ErrMaxActiveConnReached 连接池超限 7 ErrMaxActiveConnReached = errors.New("max active conn reached") 8 // ErrClosed 连接已关闭 9 ErrClosed = errors.New("pool is closed") 10 // ErrIsNil 连接无效 11 ErrIsNil = errors.New("connection is nil. rejecting") 12 ) 13 14 // Pool 基本方法 15 type Pool interface { 16 // Get 获取一个连接 17 Get() (any, error) 18 // Put 归还一个连接 19 Put(any) error 20 // Close 关闭连接 21 Close(any) error 22 // CloseAll 关闭全部连接 23 CloseAll() 24 // Release 释放连接池 25 Release() 26 // Len 连接数 27 Len() int 28 }