Jelajahi Sumber

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

and new page is available.
Artem Chernyshev 10 tahun lalu
induk
melakukan
ff243aa32a
2 mengubah file dengan 7 tambahan dan 0 penghapusan
  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>
 Johnny Bergström <johnny@joonix.se>
 Adriano Orioli <orioli.adriano@gmail.com>
 Adriano Orioli <orioli.adriano@gmail.com>
 Claudiu Raveica <claudiu.raveica@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
 	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.
 // checkErrAndNotFound handle error and NotFound in one method.
 func (iter *Iter) checkErrAndNotFound() error {
 func (iter *Iter) checkErrAndNotFound() error {
 	if iter.err != nil {
 	if iter.err != nil {