Skip to content
This repository was archived by the owner on Mar 11, 2022. It is now read-only.

Commit 59fd77a

Browse files
authored
Merge pull request #495 from markewallace/total_row_count
Add total row count getter to AllDocsResponse
2 parents 2153b20 + 0ce908f commit 59fd77a

4 files changed

Lines changed: 14 additions & 0 deletions

File tree

CHANGES.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,6 @@
1+
# Unreleased
2+
- [NEW] Add getter for total row count to AllDocsResponse
3+
14
# 2.18.0 (2019-10-02)
25
- [FIXED] Create an array of strings for QueryBuilder.fields() when a single field is provided.
36
- [FIXED] Potential NPE creating exception messages.

cloudant-client/src/main/java/com/cloudant/client/api/views/AllDocsResponse.java

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -93,4 +93,9 @@ public interface AllDocsResponse {
9393
*/
9494
Map<String, String> getErrors();
9595

96+
/**
97+
* @return the total number of rows in the _all_docs view, before any filtering has taken place
98+
* @since 2.19.0
99+
*/
100+
Long getTotalRowCount();
96101
}

cloudant-client/src/main/java/com/cloudant/client/internal/views/AllDocsRequestResponse.java

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -82,6 +82,11 @@ public Map<String, String> getErrors() {
8282
return errors;
8383
}
8484

85+
@Override
86+
public Long getTotalRowCount() {
87+
return response.getTotalRowCount();
88+
}
89+
8590
/*
8691
* Object representation of rev field from a JSON object.
8792
* <P>

cloudant-client/src/test/java/com/cloudant/tests/ViewsTest.java

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -732,6 +732,7 @@ public void allDocsWithKeysDocDeleted() throws Exception {
732732
assertThat(response.getDocs().get(1).isDeleted(), is(true));
733733
assertThat(response.getDocs().get(1).getId(), is(response2.getId()));
734734
assertThat(response.getDocs().get(1).getRevision(), is(removeResponse.getRev()));
735+
assertThat(response.getTotalRowCount(), is(8L));
735736
}
736737

737738
// all docs with given keys, one document deleted:

0 commit comments

Comments
 (0)