From e4632da034815fca8930d77fccde37777b16f465 Mon Sep 17 00:00:00 2001 From: MOZGIII Date: Tue, 23 Oct 2018 14:41:21 +0300 Subject: [PATCH] Added CheckedOutConnections for ConnPoolStat Closes #468 --- conn_pool.go | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/conn_pool.go b/conn_pool.go index 27ca3531..270b992f 100644 --- a/conn_pool.go +++ b/conn_pool.go @@ -41,6 +41,12 @@ type ConnPoolStat struct { AvailableConnections int // unused live connections } +// CheckedOutConnections returns the amount of connections that are currently +// checked out from the pool. +func (stat *ConnPoolStat) CheckedOutConnections() int { + return stat.CurrentConnections - stat.AvailableConnections +} + // ErrAcquireTimeout occurs when an attempt to acquire a connection times out. var ErrAcquireTimeout = errors.New("timeout acquiring connection from pool")