Many resources are needed to download a project. Please understand that we have to compensate our server costs. Thank you in advance. Project price only 1 $
You can buy this project and download/modify it how often you want.
package com.couchbase.lite;
import com.couchbase.lite.internal.InterfaceAudience;
import com.couchbase.lite.util.Log;
import java.util.ArrayList;
import java.util.List;
import java.util.concurrent.Future;
/**
* Represents a query of a CouchbaseLite 'view', or of a view-like resource like _all_documents.
*/
public class Query {
/**
* Determines whether or when the view index is updated. By default, the index will be updated
* if necessary before the query runs -- this guarantees up-to-date results but can cause a delay.
*/
public enum IndexUpdateMode {
BEFORE, // Always update index if needed before querying (default)
NEVER, // Don't update the index; results may be out of date
AFTER // Update index _after_ querying (results may still be out of date)
}
/**
* Changes the behavior of a query created by queryAllDocuments.
*/
public enum AllDocsMode {
ALL_DOCS, // (the default), the query simply returns all non-deleted documents.
INCLUDE_DELETED, // in this mode it also returns deleted documents.
SHOW_CONFLICTS, // the .conflictingRevisions property of each row will return the conflicting revisions, if any, of that document.
ONLY_CONFLICTS, // _only_ documents in conflict will be returned. (This mode is especially useful for use with a CBLLiveQuery, so you can be notified of conflicts as they happen, i.e. when they're pulled in by a replication.)
BY_SEQUENCE // Order by sequence number (i.e. chronologically)
}
/**
* The database that contains this view.
*/
private Database database;
/**
* The view object associated with this query
*/
private View view; // null for _all_docs query
/**
* Is this query based on a temporary view?
*/
private boolean temporaryView;
/**
* The number of initial rows to skip. Default value is 0.
* Should only be used with small values. For efficient paging, use startKey and limit.
*/
private int skip;
/**
* The maximum number of rows to return. Default value is 0, meaning 'unlimited'.
*/
private int limit = Integer.MAX_VALUE;
/**
* If non-nil, the key value to start at.
*/
private Object startKey;
/**
* If non-nil, the key value to end after.
*/
private Object endKey;
/**
* If non-nil, the document ID to start at.
* (Useful if the view contains multiple identical keys, making .startKey ambiguous.)
*/
private String startKeyDocId;
/**
* If non-nil, the document ID to end at.
* (Useful if the view contains multiple identical keys, making .endKey ambiguous.)
*/
private String endKeyDocId;
/**
* If YES (the default) the startKey (or startKeyDocID) comparison uses ">=". Else it uses ">".
*/
private boolean inclusiveStart;
/**
* If YES (the default) the endKey (or endKeyDocID) comparison uses "<=". Else it uses "<".
*/
private boolean inclusiveEnd;
/**
* If set, the view will not be updated for this query, even if the database has changed.
* This allows faster results at the expense of returning possibly out-of-date data.
*/
private IndexUpdateMode indexUpdateMode;
/**
* Changes the behavior of a query created by -queryAllDocuments.
*
* - In mode kCBLAllDocs (the default), the query simply returns all non-deleted documents.
* - In mode kCBLIncludeDeleted, it also returns deleted documents.
* - In mode kCBLShowConflicts, the .conflictingRevisions property of each row will return the
* conflicting revisions, if any, of that document.
* - In mode kCBLOnlyConflicts, _only_ documents in conflict will be returned.
* (This mode is especially useful for use with a CBLLiveQuery, so you can be notified of
* conflicts as they happen, i.e. when they're pulled in by a replication.)
*/
private AllDocsMode allDocsMode;
/**
* Should the rows be returned in descending key order? Default value is NO.
*/
private boolean descending;
/**
* If set to YES, the results will include the entire document contents of the associated rows.
* These can be accessed via QueryRow's -documentProperties property.
* This slows down the query, but can be a good optimization if you know you'll need the entire
* contents of each document. (This property is equivalent to "include_docs" in the CouchDB API.)
*/
private boolean prefetch;
/**
* If set to YES, disables use of the reduce function.
* (Equivalent to setting "?reduce=false" in the REST API.)
*/
private boolean mapOnly;
/**
* If set to YES, queries created by -createAllDocumentsQuery will include deleted documents.
* This property has no effect in other types of queries.
*/
private boolean includeDeleted;
/**
* If non-nil, the query will fetch only the rows with the given keys.
*/
private List