mirror of https://github.com/go-gorm/gorm.git
1. fix bug : https://github.com/jinzhu/gorm/issues/2700
This commit is contained in:
parent
9d2b65f8c9
commit
f616ccd397
5
main.go
5
main.go
|
@ -124,7 +124,10 @@ func (s *DB) Close() error {
|
|||
// DB get `*sql.DB` from current connection
|
||||
// If the underlying database connection is not a *sql.DB, returns nil
|
||||
func (s *DB) DB() *sql.DB {
|
||||
db, _ := s.db.(*sql.DB)
|
||||
db, ok := s.db.(*sql.DB)
|
||||
if !ok {
|
||||
panic("can't support full GORM on currently status, maybe this is a TX instance.")
|
||||
}
|
||||
return db
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue