Correct work RecordNotFound for RAW SQL
This commit is contained in:
parent
f6260a0085
commit
b5db07738d
15
main.go
15
main.go
@ -530,9 +530,18 @@ func (s *DB) NewRecord(value interface{}) bool {
|
||||
|
||||
// RecordNotFound check if returning ErrRecordNotFound error
|
||||
func (s *DB) RecordNotFound() bool {
|
||||
for _, err := range s.GetErrors() {
|
||||
if err == ErrRecordNotFound {
|
||||
return true
|
||||
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() {
|
||||
if err == ErrRecordNotFound {
|
||||
return true
|
||||
}
|
||||
}
|
||||
}
|
||||
return false
|
||||
|
Loading…
x
Reference in New Issue
Block a user