From e6a2273114af350233679ac981ef5106ba03d709 Mon Sep 17 00:00:00 2001 From: Jinzhu Date: Wed, 4 Dec 2013 14:33:35 +0800 Subject: [PATCH] Remove method SetPool() in favour of sql package's builtin method, Use it like this `db.DB().SetMaxIdleConns(10)` So gorm don't need to care about compatibility problems, and you could use latest `database/sql` features from latest releases without waiting gorm's support --- gorm_test.go | 2 +- main.go | 6 ------ sql.go | 1 - 3 files changed, 1 insertion(+), 8 deletions(-) diff --git a/gorm_test.go b/gorm_test.go index cbcfbf14..1bc7c682 100644 --- a/gorm_test.go +++ b/gorm_test.go @@ -91,7 +91,7 @@ func init() { // CREATE DATABASE 'gorm'; // GRANT ALL ON gorm.* TO 'gorm'@'localhost'; fmt.Println("testing mysql...") - db, err = Open("mysql", "gorm:gorm@/gorim?charset=utf8&parseTime=True") + db, err = Open("mysql", "gorm:gorm@/gorm?charset=utf8&parseTime=True") case "sqlite": fmt.Println("testing sqlite3...") db, err = Open("sqlite3", "/tmp/gorm.db") diff --git a/main.go b/main.go index 57b31809..cfda79c4 100644 --- a/main.go +++ b/main.go @@ -31,12 +31,6 @@ func (s *DB) DB() *sql.DB { return s.db.(*sql.DB) } -func (s *DB) SetPool(n int) { - if db, ok := s.parent.db.(sqlDb); ok { - db.SetMaxIdleConns(n) - } -} - func (s *DB) SetTagIdentifier(str string) { s.parent.tagIdentifier = str } diff --git a/sql.go b/sql.go index ac781db5..7b02aa66 100644 --- a/sql.go +++ b/sql.go @@ -11,7 +11,6 @@ type sqlCommon interface { type sqlDb interface { Begin() (*sql.Tx, error) - SetMaxIdleConns(n int) } type sqlTx interface {