瀏覽代碼

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

Chris Bannister 9 年之前
父節點
當前提交
1440c60966
共有 1 個文件被更改,包括 7 次插入0 次删除
  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