Add method to close gorm db connection

This commit is contained in:
Jinzhu 2014-04-24 10:54:27 +08:00
parent 8e3181494d
commit fd3ce3b39a
2 changed files with 7 additions and 3 deletions

View File

@ -28,6 +28,10 @@ func Open(driver, source string) (DB, error) {
return db, err
}
func (s *DB) Close() error {
return s.parent.db.(*sql.DB).Close()
}
func (s *DB) DB() *sql.DB {
return s.db.(*sql.DB)
}

View File

@ -7,9 +7,9 @@ import (
"fmt"
_ "github.com/go-sql-driver/mysql"
"github.com/jinzhu/gorm"
_ "github.com/lib/pq"
_ "github.com/mattn/go-sqlite3"
"github.com/jinzhu/gorm"
"os"
"reflect"