mirror of https://github.com/go-gorm/gorm.git
Add method to close gorm db connection
This commit is contained in:
parent
8e3181494d
commit
fd3ce3b39a
4
main.go
4
main.go
|
@ -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)
|
||||
}
|
||||
|
|
|
@ -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"
|
||||
|
|
Loading…
Reference in New Issue