Reviewed-on: https://gitea.com/xorm/xorm/pulls/2046
Co-authored-by: Lunny Xiao <xiaolunwen@gmail.com>
Co-committed-by: Lunny Xiao <xiaolunwen@gmail.com>
This commit is contained in:
Lunny Xiao 2021-09-13 15:19:59 +08:00
parent 7cd6a74c9f
commit 55f95db028
1 changed files with 8 additions and 2 deletions

10
rows.go
View File

@ -84,12 +84,18 @@ func newRows(session *Session, bean interface{}) (*Rows, error) {
// Next move cursor to next record, return false if end has reached
func (rows *Rows) Next() bool {
return rows.rows.Next()
if rows.rows != nil {
return rows.rows.Next()
}
return false
}
// Err returns the error, if any, that was encountered during iteration. Err may be called after an explicit or implicit Close.
func (rows *Rows) Err() error {
return rows.rows.Err()
if rows.rows != nil {
return rows.rows.Err()
}
return nil
}
// Scan row record to bean properties