public class View
extends java.lang.Object
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(...);
CouchDbClientBase.view(String)
,
ViewResult
Modifier and Type | Method and Description |
---|---|
View |
descending(java.lang.Boolean descending)
Reverses the reading direction, not the sort order.
|
View |
endKey(java.lang.Object... endKey) |
View |
endKeyDocId(java.lang.String endKeyDocId) |
View |
group(java.lang.Boolean group) |
View |
groupLevel(java.lang.Integer groupLevel) |
View |
includeDocs(java.lang.Boolean includeDocs) |
View |
inclusiveEnd(java.lang.Boolean inclusiveEnd) |
View |
key(java.lang.Object... key) |
View |
keys(java.util.List<?> keys)
Supplies a key list when calling _all_docs View.
|
View |
limit(java.lang.Integer limit) |
<T> java.util.List<T> |
query(java.lang.Class<T> classOfT)
Queries a view.
|
boolean |
queryForBoolean() |
int |
queryForInt() |
long |
queryForLong() |
java.io.InputStream |
queryForStream()
Queries a view as an
InputStream |
java.lang.String |
queryForString() |
<T> Page<T> |
queryPage(int rowsPerPage,
java.lang.String param,
java.lang.Class<T> classOfT)
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 a
null param. |
<K,V,T> ViewResult<K,V,T> |
queryView(java.lang.Class<K> classOfK,
java.lang.Class<V> classOfV,
java.lang.Class<T> classOfT)
Queries a view.
|
View |
reduce(java.lang.Boolean reduce) |
View |
skip(java.lang.Integer skip) |
View |
stale(java.lang.String stale) |
View |
startKey(java.lang.Object... startKey) |
View |
startKeyDocId(java.lang.String startKeyDocId) |
View |
updateSeq(java.lang.Boolean updateSeq) |
public java.io.InputStream queryForStream()
InputStream
The stream should be properly closed after usage, as to avoid connection leaks.
InputStream
.public <T> java.util.List<T> query(java.lang.Class<T> classOfT)
T
- Object type TclassOfT
- The class of type TList<T>
public <K,V,T> ViewResult<K,V,T> queryView(java.lang.Class<K> classOfK, java.lang.Class<V> classOfV, java.lang.Class<T> classOfT)
K
- Object type K (key)V
- Object type V (value)T
- The class typeclassOfK
- The class of type K.classOfV
- The class of type V.classOfT
- The class of type T.public java.lang.String queryForString()
public int queryForInt()
public long queryForLong()
public boolean queryForBoolean()
public <T> Page<T> queryPage(int rowsPerPage, java.lang.String param, java.lang.Class<T> classOfT)
null
param.T
- Object type TrowsPerPage
- The number of rows per page.param
- The request parameter to use to query a page, or null
to return the first page.classOfT
- The class of type T.Page
public View key(java.lang.Object... key)
key
- The key value, accepts a single value or multiple values for complex keys.View
public View startKey(java.lang.Object... startKey)
startKey
- The start key value, accepts a single value or multiple values for complex keys.View
public View startKeyDocId(java.lang.String startKeyDocId)
startKeyDocId
- The start key document id.View
public View endKey(java.lang.Object... endKey)
endKey
- The end key value, accepts a single value or multiple values for complex keys.View
public View endKeyDocId(java.lang.String endKeyDocId)
endKeyDocId
- The end key document id.View
public View stale(java.lang.String stale)
stale
- Accept values: ok | update_after (update_after as of CouchDB 1.1.0)View
public View descending(java.lang.Boolean descending)
descending
- The descending value true | falseView
public View skip(java.lang.Integer skip)
skip
- Skips n number of documents.View
public View group(java.lang.Boolean group)
group
- Specifies whether the reduce function reduces the result to a set of keys,
or to a single result. Defaults to false (single result).View
public View groupLevel(java.lang.Integer groupLevel)
groupLevel
- The group levelView
public View reduce(java.lang.Boolean reduce)
reduce
- Indicates whether to use the reduce function of the view,
defaults to true if the reduce function is defined.View
public View includeDocs(java.lang.Boolean includeDocs)
includeDocs
- Indicates whether to include documentsView
public View inclusiveEnd(java.lang.Boolean inclusiveEnd)
inclusiveEnd
- Indicates whether the endkey is included in the result,
defaults to true.View
public View updateSeq(java.lang.Boolean updateSeq)
updateSeq
- Indicates whether to include sequence id of the viewView
Copyright © 2011-2017. All Rights Reserved.