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
|
CreateBatchSize int
|
||||||
// TranslateError enabling error translation
|
// TranslateError enabling error translation
|
||||||
TranslateError bool
|
TranslateError bool
|
||||||
|
// PropagateUnscoped propagate Unscoped to every other nested statement
|
||||||
|
PropagateUnscoped bool
|
||||||
|
|
||||||
// ClauseBuilders clause builder
|
// ClauseBuilders clause builder
|
||||||
ClauseBuilders map[string]clause.ClauseBuilder
|
ClauseBuilders map[string]clause.ClauseBuilder
|
||||||
@ -409,6 +411,9 @@ func (db *DB) getInstance() *DB {
|
|||||||
Vars: make([]interface{}, 0, 8),
|
Vars: make([]interface{}, 0, 8),
|
||||||
SkipHooks: db.Statement.SkipHooks,
|
SkipHooks: db.Statement.SkipHooks,
|
||||||
}
|
}
|
||||||
|
if db.Config.PropagateUnscoped {
|
||||||
|
tx.Statement.Unscoped = db.Statement.Unscoped
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
// with clone statement
|
// with clone statement
|
||||||
tx.Statement = db.Statement.clone()
|
tx.Statement = db.Statement.clone()
|
||||||
|
Loading…
x
Reference in New Issue
Block a user