Class CosmosQuery
java.lang.Object
com.azure.spring.data.cosmos.core.query.CosmosQuery
Class for cosmos query
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionTo get Criteria objectgetCriteriaByType
(CriteriaType criteriaType) To get criteria by typeint
getLimit()
To get limit numberlong
To get offset numberorg.springframework.data.domain.Pageable
To get Pageable objectgetPartitionKeyValue
(Class<T> domainType) Returns partition key value based on the criteria.org.springframework.data.domain.Sort
getSort()
To get Sort objectboolean
hasPartitionKeyCriteria
(String partitionKeyFieldName) Returns true if this criteria or sub-criteria has partition key field present as one of the subjects.boolean
isCrossPartitionQuery
(List<String> partitionKeys) Indicate if DocumentQuery should enable cross partition query.void
setLimit
(int limit) Deprecated.use withLimit insteadwith
(org.springframework.data.domain.Pageable pageable) With Sortwith
(org.springframework.data.domain.Sort sort) With SortwithLimit
(int limit) To set limit numberwithOffsetAndLimit
(long offset, int limit) To set limit number and offset number
-
Constructor Details
-
CosmosQuery
Initialization- Parameters:
criteria
- object
-
-
Method Details
-
getCriteria
To get Criteria object- Returns:
- Criteria
-
getSort
public org.springframework.data.domain.Sort getSort()To get Sort object- Returns:
- Sort
-
getPageable
public org.springframework.data.domain.Pageable getPageable()To get Pageable object- Returns:
- Pageable
-
getLimit
public int getLimit()To get limit number- Returns:
- int limit
-
getOffset
public long getOffset()To get offset number- Returns:
- long offset
-
setLimit
Deprecated.use withLimit insteadTo set limit number- Parameters:
limit
- int
-
withLimit
To set limit number- Parameters:
limit
- int- Returns:
- CosmosQuery object
-
withOffsetAndLimit
To set limit number and offset number- Parameters:
offset
- longlimit
- int- Returns:
- CosmosQuery object
-
with
With Sort- Parameters:
sort
- Sort- Returns:
- CosmosQuery object
-
with
With Sort- Parameters:
pageable
- Sort- Returns:
- CosmosQuery object
-
isCrossPartitionQuery
Indicate if DocumentQuery should enable cross partition query.- Parameters:
partitionKeys
- The list of partitionKey names.- Returns:
- If DocumentQuery should enable cross partition query
-
hasPartitionKeyCriteria
Returns true if this criteria or sub-criteria has partition key field present as one of the subjects.- Parameters:
partitionKeyFieldName
- partition key field name- Returns:
- returns true if this criteria or sub criteria has partition key field present as one of the subjects.
-
getPartitionKeyValue
Returns partition key value based on the criteria.- Type Parameters:
T
- entity class type- Parameters:
domainType
- domain type- Returns:
- Optional of partition key value
-
getCriteriaByType
To get criteria by type- Parameters:
criteriaType
- the criteria type- Returns:
- Optional
-