adds PropagateUnscoped to db Config
This commit is contained in:
parent
9d370bcb3e
commit
24a04bc286
5
gorm.go
5
gorm.go
@ -50,6 +50,8 @@ type Config struct {
|
||||
CreateBatchSize int
|
||||
// TranslateError enabling error translation
|
||||
TranslateError bool
|
||||
// PropagateUnscoped propagate Unscoped to every other nested statement
|
||||
PropagateUnscoped bool
|
||||
|
||||
// ClauseBuilders clause builder
|
||||
ClauseBuilders map[string]clause.ClauseBuilder
|
||||
@ -409,6 +411,9 @@ func (db *DB) getInstance() *DB {
|
||||
Vars: make([]interface{}, 0, 8),
|
||||
SkipHooks: db.Statement.SkipHooks,
|
||||
}
|
||||
if db.Config.PropagateUnscoped {
|
||||
tx.Statement.Unscoped = db.Statement.Unscoped
|
||||
}
|
||||
} else {
|
||||
// with clone statement
|
||||
tx.Statement = db.Statement.clone()
|
||||
|
Loading…
x
Reference in New Issue
Block a user