Add error if exists after parse query results

This commit is contained in:
Jinzhu 2017-02-02 22:29:41 +08:00
parent 1092523ce2
commit 23abd03a95
1 changed files with 4 additions and 0 deletions

View File

@ -78,6 +78,10 @@ func queryCallback(scope *Scope) {
} }
} }
if err := rows.Err(); err != nil {
scope.Err(err)
}
if scope.db.RowsAffected == 0 && !isSlice { if scope.db.RowsAffected == 0 && !isSlice {
scope.Err(ErrRecordNotFound) scope.Err(ErrRecordNotFound)
} }