Class View
java.lang.Object
org.lightcouch.View
This class provides access to the View APIs.
Usage Example:
List<Foo> list = dbClient.view("example/foo")
.startKey("start-key")
.endKey("end-key")
.limit(10)
.includeDocs(true)
.query(Foo.class);
// scalar values
int count = dbClient.view("example/by_tag")
.key("couchdb")
.queryForInt();
// pagination
Page<Foo> page = dbClient.view("example/foo").queryPage(...);
- Since:
- 0.0.2
- Author:
- Ahmed Yehia
- See Also:
-
Method Summary
Modifier and TypeMethodDescriptiondescending(Boolean descending) Reverses the reading direction, not the sort order.endKeyDocId(String endKeyDocId) groupLevel(Integer groupLevel) includeDocs(Boolean includeDocs) inclusiveEnd(Boolean inclusiveEnd) Supplies a key list when calling _all_docs View.<T> List<T> Queries a view.booleanintlongQueries a view as anInputStream<T> Page<T> Queries a view for pagination, returns a next or a previous page, this method figures out which page to return based on the given param that is generated by an earlier call to this method, quering the first page is done by passing anullparam.<K,V, T> ViewResult <K, V, T> Queries a view.startKeyDocId(String startKeyDocId)
-
Method Details
-
queryForStream
Queries a view as anInputStreamThe stream should be properly closed after usage, as to avoid connection leaks.
- Returns:
- The result as an
InputStream.
-
query
-
queryView
Queries a view.- Type Parameters:
K- Object type K (key)V- Object type V (value)T- The class type- Parameters:
classOfK- The class of type K.classOfV- The class of type V.classOfT- The class of type T.- Returns:
- The View result entries.
-
queryForString
- Returns:
- The result of the view as String.
-
queryForInt
public int queryForInt()- Returns:
- The result of the view as int.
-
queryForLong
public long queryForLong()- Returns:
- The result of the view as long.
-
queryForBoolean
public boolean queryForBoolean()- Returns:
- The result of the view as boolean.
-
queryPage
Queries a view for pagination, returns a next or a previous page, this method figures out which page to return based on the given param that is generated by an earlier call to this method, quering the first page is done by passing anullparam.- Type Parameters:
T- Object type T- Parameters:
rowsPerPage- The number of rows per page.param- The request parameter to use to query a page, ornullto return the first page.classOfT- The class of type T.- Returns:
Page
-
key
-
startKey
-
startKeyDocId
-
endKey
-
endKeyDocId
-
limit
-
stale
-
descending
-
skip
-
group
-
groupLevel
-
reduce
-
includeDocs
-
inclusiveEnd
-
updateSeq
-
keys
-