فهرست منبع

Added a method which returns true if iterator reached end of the page

and new page is available.
Artem Chernyshev 10 سال پیش
والد
کامیت
ff243aa32a
2فایلهای تغییر یافته به همراه7 افزوده شده و 0 حذف شده
  1. 1 0
      AUTHORS
  2. 6 0
      session.go

+ 1 - 0
AUTHORS

@@ -60,3 +60,4 @@ Daniel Cannon <daniel@danielcannon.co.uk>
 Johnny Bergström <johnny@joonix.se>
 Adriano Orioli <orioli.adriano@gmail.com>
 Claudiu Raveica <claudiu.raveica@gmail.com>
+Artem Chernyshev <artem.0xD2@gmail.com>

+ 6 - 0
session.go

@@ -884,6 +884,12 @@ func (iter *Iter) Close() error {
 	return iter.err
 }
 
+// WillSwitchPage detects if iterator reached end of current page
+// and the next page is available.
+func (iter *Iter) WillSwitchPage() bool {
+	return iter.pos >= len(iter.rows) && iter.next != nil
+}
+
 // checkErrAndNotFound handle error and NotFound in one method.
 func (iter *Iter) checkErrAndNotFound() error {
 	if iter.err != nil {