Correct work RecordNotFound for RAW SQL
This commit is contained in:
parent
f6260a0085
commit
b5db07738d
9
main.go
9
main.go
@ -530,11 +530,20 @@ func (s *DB) NewRecord(value interface{}) bool {
|
|||||||
|
|
||||||
// RecordNotFound check if returning ErrRecordNotFound error
|
// RecordNotFound check if returning ErrRecordNotFound error
|
||||||
func (s *DB) RecordNotFound() bool {
|
func (s *DB) RecordNotFound() bool {
|
||||||
|
if s.search.raw {
|
||||||
|
rows, err := s.Rows()
|
||||||
|
defer rows.Close()
|
||||||
|
if err != nil {
|
||||||
|
return false
|
||||||
|
}
|
||||||
|
return !rows.Next()
|
||||||
|
} else {
|
||||||
for _, err := range s.GetErrors() {
|
for _, err := range s.GetErrors() {
|
||||||
if err == ErrRecordNotFound {
|
if err == ErrRecordNotFound {
|
||||||
return true
|
return true
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
return false
|
return false
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user