doctrine / couchdb-client

CouchDB Client library
MIT License
122 stars 68 forks source link

Provide access to the offset of a view result #24

Closed danielkbx closed 8 years ago

danielkbx commented 10 years ago

Especially for easy pagination I often need access to the offset of a view result. Instead of maintaining it in the controller/view I added a getter to the result class:

diff --git a/application/library/Doctrine/CouchDB/View/Result.php b/application/library/Doctrine/CouchDB/View/Result.php
index 6398a17..3956bd0 100644
--- a/application/library/Doctrine/CouchDB/View/Result.php
+++ b/application/library/Doctrine/CouchDB/View/Result.php
@@ -67,4 +67,8 @@ class Result implements \IteratorAggregate, \Countable, \ArrayAccess
     {
         return $this->result['rows'];
     }
+
+    public function getOffset() {
+        return $this->result['offset'];
+    }
 }

It would be great if you could integrate it.

danielkbx

beberlei commented 8 years ago

Implemented in 154efaa