From 7a55fef94cb6768bf3c5b1f7480e2fe11c1056df Mon Sep 17 00:00:00 2001 From: Abdelaziz Elrashed Date: Tue, 2 Feb 2021 11:55:38 +0300 Subject: [PATCH] Add NewDB as a Shortcut Call --- gorm.go | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/gorm.go b/gorm.go index 1109e8cd..728ae510 100644 --- a/gorm.go +++ b/gorm.go @@ -248,6 +248,11 @@ func (db *DB) Debug() (tx *DB) { }) } +// NewDB clone a new db connection without search conditions +func (db *DB) NewDB() *DB { + return db.Session(&Session{NewDB: true}) +} + // Set store value with key into current db instance's context func (db *DB) Set(key string, value interface{}) *DB { tx := db.getInstance()