From b74a9a8699a8dc536071d57aba96227bd1ccab7d Mon Sep 17 00:00:00 2001 From: MaximMinaev Date: Sat, 29 Sep 2018 01:13:48 +0300 Subject: [PATCH] set MaxIdleConns and MaxOpenConns --- main.go | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/main.go b/main.go index 17c75ed3..dd2521ee 100644 --- a/main.go +++ b/main.go @@ -115,6 +115,17 @@ func (s *DB) DB() *sql.DB { return db } +// SetMaxIdleConns sets the maximum number of connections in the idle +// connection pool +func (s *DB) SetMaxIdleConns(count int) { + s.db.(*sql.DB).SetMaxIdleConns(count) +} + +// SetMaxOpenConns sets the maximum number of open connections to the database. +func (s *DB) SetMaxOpenConns(count int) { + s.db.(*sql.DB).SetMaxOpenConns(count) +} + // CommonDB return the underlying `*sql.DB` or `*sql.Tx` instance, mainly intended to allow coexistence with legacy non-GORM code. func (s *DB) CommonDB() SQLCommon { return s.db