Bläddra i källkod

iter: expose number of rows in the iter (#712)

Chris Bannister 9 år sedan
förälder
incheckning
1440c60966
1 ändrade filer med 7 tillägg och 0 borttagningar
  1. 7 0
      session.go

+ 7 - 0
session.go

@@ -1064,6 +1064,13 @@ func (iter *Iter) PageState() []byte {
 	return iter.meta.pagingState
 	return iter.meta.pagingState
 }
 }
 
 
+// NumRows returns the number of rows in this pagination, it will update when new
+// pages are fetcehd, it is not the value of the total number of rows this iter
+// will return unless there is only a single page returned.
+func (iter *Iter) NumRows() int {
+	return iter.numRows
+}
+
 type nextIter struct {
 type nextIter struct {
 	qry  Query
 	qry  Query
 	pos  int
 	pos  int