This commit is contained in:
misko 2019-10-14 14:13:18 +08:00 committed by Jinzhu
parent 9d2b65f8c9
commit f616ccd397
1 changed files with 4 additions and 1 deletions

View File

@ -124,7 +124,10 @@ func (s *DB) Close() error {
// DB get `*sql.DB` from current connection // DB get `*sql.DB` from current connection
// If the underlying database connection is not a *sql.DB, returns nil // If the underlying database connection is not a *sql.DB, returns nil
func (s *DB) DB() *sql.DB { 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 return db
} }