From f616ccd39773f0b1c6967aab3eb1de4f04dd001f Mon Sep 17 00:00:00 2001 From: misko Date: Mon, 14 Oct 2019 14:13:18 +0800 Subject: [PATCH] 1. fix bug : https://github.com/jinzhu/gorm/issues/2700 --- main.go | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/main.go b/main.go index 24fd8382..3db87870 100644 --- a/main.go +++ b/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 }