forked from mirror/gorm
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
This commit is contained in:
parent
90a4581a7f
commit
e6a2273114
|
@ -91,7 +91,7 @@ func init() {
|
||||||
// CREATE DATABASE 'gorm';
|
// CREATE DATABASE 'gorm';
|
||||||
// GRANT ALL ON gorm.* TO 'gorm'@'localhost';
|
// GRANT ALL ON gorm.* TO 'gorm'@'localhost';
|
||||||
fmt.Println("testing mysql...")
|
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":
|
case "sqlite":
|
||||||
fmt.Println("testing sqlite3...")
|
fmt.Println("testing sqlite3...")
|
||||||
db, err = Open("sqlite3", "/tmp/gorm.db")
|
db, err = Open("sqlite3", "/tmp/gorm.db")
|
||||||
|
|
6
main.go
6
main.go
|
@ -31,12 +31,6 @@ func (s *DB) DB() *sql.DB {
|
||||||
return s.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) {
|
func (s *DB) SetTagIdentifier(str string) {
|
||||||
s.parent.tagIdentifier = str
|
s.parent.tagIdentifier = str
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue