forked from mirror/gorm
Add Session Initialized option
This commit is contained in:
parent
cec0d32aec
commit
98c4b78e4d
5
gorm.go
5
gorm.go
|
@ -96,6 +96,7 @@ type Session struct {
|
|||
DryRun bool
|
||||
PrepareStmt bool
|
||||
NewDB bool
|
||||
Initialized bool
|
||||
SkipHooks bool
|
||||
SkipDefaultTransaction bool
|
||||
DisableNestedTransaction bool
|
||||
|
@ -282,6 +283,10 @@ func (db *DB) Session(config *Session) *DB {
|
|||
tx.Config.NowFunc = config.NowFunc
|
||||
}
|
||||
|
||||
if config.Initialized {
|
||||
tx = tx.getInstance()
|
||||
}
|
||||
|
||||
return tx
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue