java.lang.Object
org.springframework.data.couchbase.core.query.Query
Direct Known Subclasses:
BasicQuery, N1QLQuery, StringQuery

public class Query extends Object
Author:
Michael Nitschinger, Michael Reiche
  • Field Details

    • sort

      protected Sort sort
  • Constructor Details

  • Method Details

    • query

      public static Query query(QueryCriteriaDefinition criteriaDefinition)
    • addCriteria

      public Query addCriteria(QueryCriteriaDefinition criteriaDefinition)
    • getCriteriaList

      protected List<QueryCriteriaDefinition> getCriteriaList()
    • setPositionalParameters

      public Query setPositionalParameters(com.couchbase.client.java.json.JsonArray parameters)
      set the postional parameters on the query object There can only be named parameters or positional parameters - not both.
      Parameters:
      parameters - - the positional parameters
      Returns:
      - the query
    • setNamedParameters

      public Query setNamedParameters(com.couchbase.client.java.json.JsonObject parameters)
      set the named parameters on the query object There can only be named parameters or positional parameters - not both.
      Parameters:
      parameters - - the named parameters
      Returns:
      - the query
    • skip

      public Query skip(long skip)
      Set number of documents to skip before returning results.
      Parameters:
      skip -
      Returns:
    • limit

      public Query limit(int limit)
      Limit the number of returned documents to limit.
      Parameters:
      limit -
      Returns:
    • distinct

      public Query distinct(boolean distinct)
      Is this a DISTINCT query? distinct.
      Parameters:
      distinct -
      Returns:
    • isDistinct

      public boolean isDistinct()
      Is this a DISTINCT query? distinct.
      Returns:
      distinct
    • distinct

      public Query distinct(String[] distinctFields)
      distinctFields for query (non-null but empty means all fields) ? distinctFields.
      Parameters:
      distinctFields -
      Returns:
    • getDistinctFields

      public String[] getDistinctFields()
      distinctFields for query (non-null but empty means all fields) ? distinctFields.
      Returns:
      distinctFields
    • with

      public Query with(Pageable pageable)
      Sets the given pagination information on the Query instance. Will transparently set skip and limit as well as applying the Sort instance defined with the Pageable.
      Parameters:
      pageable -
      Returns:
    • getScanConsistency

      public com.couchbase.client.java.query.QueryScanConsistency getScanConsistency()
      queryScanConsistency
      Returns:
      queryScanConsistency
    • scanConsistency

      public Query scanConsistency(com.couchbase.client.java.query.QueryScanConsistency queryScanConsistency)
      Sets the given scan consistency on the Query instance.
      Parameters:
      queryScanConsistency -
      Returns:
      this
    • with

      public Query with(Sort sort)
      Adds a Sort to the Query instance.
      Parameters:
      sort -
      Returns:
    • withoutSort

      public Query withoutSort()
    • appendSkipAndLimit

      public void appendSkipAndLimit(StringBuilder sb)
    • appendSort

      public void appendSort(StringBuilder sb)
    • appendWhere

      public void appendWhere(StringBuilder sb, int[] paramIndexPtr, CouchbaseConverter converter)
    • appendWhereString

      public void appendWhereString(StringBuilder sb, String whereString)
    • appendString

      public void appendString(StringBuilder sb, String whereString)
    • export

      public String export(int[]... paramIndexPtrHolder)
    • toN1qlSelectString

      @Deprecated public String toN1qlSelectString(ReactiveCouchbaseTemplate template, Class domainClass, boolean isCount)
      Deprecated.
    • toN1qlSelectString

      public String toN1qlSelectString(CouchbaseConverter converter, String bucketName, String scopeName, String collectionName, Class domainClass, Class returnClass, boolean isCount, String[] distinctFields, String[] fields)
    • toN1qlRemoveString

      public String toN1qlRemoveString(CouchbaseConverter converter, String bucketName, String scopeName, String collectionName, Class domainClass)
    • getN1qlSpelValues

      public static StringBasedN1qlQueryParser.N1qlSpelValues getN1qlSpelValues(CouchbaseConverter converter, String bucketName, String scopeName, String collectionName, Class domainClass, Class returnClass, boolean isCount, String[] distinctFields, String[] fields)
    • buildQueryOptions

      public com.couchbase.client.java.query.QueryOptions buildQueryOptions(com.couchbase.client.java.query.QueryOptions options, com.couchbase.client.java.query.QueryScanConsistency scanConsistency)
      build QueryOptions from parameters and scanConsistency
      Parameters:
      scanConsistency -
      Returns:
      QueryOptions
    • setMeta

      public void setMeta(CouchbaseQueryMethod method, Class<?> typeToRead)
      this collections annotations from the method, repository class and possibly the entity class to be used as options. This will find annotations included in composed annotations as well. Ideally
      Parameters:
      method - representing the query.
    • getMeta

      public Meta getMeta()
    • isReadonly

      public boolean isReadonly()
    • equals

      public boolean equals(Object o)
      Overrides:
      equals in class Object