iterx: paging iteration working
We used to rely upon NumRows to determine if there are new pages available. This is not correct since the server is allowed to return empty pages with has_more_data flag set and the needed data to do this is not exposed by the gocql driver. We simply remove these checks and let the driver decide when to stop reading. Co-authored-by: Henrik Johansson <henrik@scylladb.com> Co-authored-by: Piotr Sarna <sarna@scylladb.com>
This commit is contained in:
committed by
Michal Matczuk
parent
eddedae353
commit
8b6f083cdc
17
iterx.go
17
iterx.go
@@ -80,11 +80,6 @@ func (iter *Iterx) scanAny(dest interface{}, structOnly bool) bool {
|
||||
return false
|
||||
}
|
||||
|
||||
// no results or query error
|
||||
if iter.Iter.NumRows() == 0 {
|
||||
return false
|
||||
}
|
||||
|
||||
base := reflectx.Deref(value.Type())
|
||||
scannable := isScannable(base)
|
||||
|
||||
@@ -132,11 +127,6 @@ func (iter *Iterx) scanAll(dest interface{}, structOnly bool) bool {
|
||||
return false
|
||||
}
|
||||
|
||||
// no results or query error
|
||||
if iter.Iter.NumRows() == 0 {
|
||||
return false
|
||||
}
|
||||
|
||||
slice, err := baseType(value.Type(), reflect.Slice)
|
||||
if err != nil {
|
||||
iter.err = err
|
||||
@@ -180,7 +170,7 @@ func (iter *Iterx) scanAll(dest interface{}, structOnly bool) bool {
|
||||
|
||||
// allocate memory for the page data
|
||||
if !alloc {
|
||||
v = reflect.MakeSlice(slice, 0, iter.Iter.NumRows())
|
||||
v = reflect.MakeSlice(slice, 0, iter.NumRows())
|
||||
alloc = true
|
||||
}
|
||||
|
||||
@@ -212,11 +202,6 @@ func (iter *Iterx) StructScan(dest interface{}) bool {
|
||||
return false
|
||||
}
|
||||
|
||||
// no results or query error
|
||||
if iter.Iter.NumRows() == 0 {
|
||||
return false
|
||||
}
|
||||
|
||||
if !iter.started {
|
||||
columns := columnNames(iter.Iter.Columns())
|
||||
m := iter.Mapper
|
||||
|
||||
Reference in New Issue
Block a user