Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
View Source
var (
NowFunc = time.Now // for testing
)
Functions ¶
This section is empty.
Types ¶
type Conn ¶
type Conn struct {
Err error // whether the conn is error
Inst interface{} // conn instance
// contains filtered or unexported fields
}
type ConnPool ¶
type ConnPool struct {
Connect func() (interface{}, error) //connect func,return instance,id,error
DisConnect func(c interface{}) //disconnect func
ClearConnect func(c interface{}) //clear connect data
//must init param
// Maximum number of connections allocated by the pool at a given time.
// When zero, there is no limit on the number of connections in the pool.
MaxActiveNum int
//Reserved idle connections
ReservedIdleNum int
// Close connections after remaining idle for this duration. If the value
// is zero, then idle connections are not closed. Applications should set
// the timeout to a value less than the server's timeout.
IdleTimeout time.Duration
// How many seconds wait for when the pool is at the MaxActiveNum limit
//0 forever,-1 no wait
WaitTime int64
// contains filtered or unexported fields
}
func NewConnectionPool ¶
func NewConnectionPool(maxActiveNum int, revIdleNum int, idleTimeout time.Duration, waitTime int64, connectFunc func() (interface{}, error), disConnectFunc func(interface{}), clearConnectFunc func(interface{})) *ConnPool
new connection pool
func (*ConnPool) GetActiveNum ¶
func (*ConnPool) GetIdleNum ¶
func (*ConnPool) GetWaitNum ¶
type TMOCond ¶
func NewTMOCond ¶
Click to show internal directories.
Click to hide internal directories.