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:
debug-ing 2025-01-23 10:43:15 +03:30
parent 9ca84b3dde
commit 6e0d37aaf4

View File

@ -420,6 +420,7 @@ func (db *DB) getInstance() *DB {
Clauses: map[string]clause.Clause{},
Vars: make([]interface{}, 0, 8),
SkipHooks: db.Statement.SkipHooks,
RaiseErrorOnNotFound: db.Statement.RaiseErrorOnNotFound,
}
if db.Config.PropagateUnscoped {
tx.Statement.Unscoped = db.Statement.Unscoped