fix: ensure ErrRecordNotFound is triggered on find queries
This commit ensures that ErrRecordNotFound is properly triggered when using find queries with the RaiseErrorOnNotFound flag enabled, without the need for using `WithContext`.
This commit is contained in:
parent
9ca84b3dde
commit
6e0d37aaf4
1
gorm.go
1
gorm.go
@ -420,6 +420,7 @@ func (db *DB) getInstance() *DB {
|
|||||||
Clauses: map[string]clause.Clause{},
|
Clauses: map[string]clause.Clause{},
|
||||||
Vars: make([]interface{}, 0, 8),
|
Vars: make([]interface{}, 0, 8),
|
||||||
SkipHooks: db.Statement.SkipHooks,
|
SkipHooks: db.Statement.SkipHooks,
|
||||||
|
RaiseErrorOnNotFound: db.Statement.RaiseErrorOnNotFound,
|
||||||
}
|
}
|
||||||
if db.Config.PropagateUnscoped {
|
if db.Config.PropagateUnscoped {
|
||||||
tx.Statement.Unscoped = db.Statement.Unscoped
|
tx.Statement.Unscoped = db.Statement.Unscoped
|
||||||
|
Loading…
x
Reference in New Issue
Block a user