Pārlūkot izejas kodu

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

Chris Bannister 9 gadi atpakaļ
vecāks
revīzija
1440c60966
1 mainītis faili ar 7 papildinājumiem un 0 dzēšanām
  1. 7 0
      session.go

+ 7 - 0
session.go

@@ -1064,6 +1064,13 @@ func (iter *Iter) PageState() []byte {
 	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 {
 	qry  Query
 	pos  int