Interface ReactiveCosmosOperations

All Known Implementing Classes:
ReactiveCosmosTemplate

public interface ReactiveCosmosOperations
Operation class of reactive cosmos
  • Method Details

    • getContainerName

      String getContainerName(Class<?> domainType)
      Get container name
      Parameters:
      domainType - the domainType
      Returns:
      container name
    • createContainerIfNotExists

      Mono<com.azure.cosmos.models.CosmosContainerResponse> createContainerIfNotExists(CosmosEntityInformation<?,?> information)
      Creates a container if it doesn't already exist
      Parameters:
      information - the CosmosEntityInformation
      Returns:
      Mono of CosmosContainerResponse
    • getContainerProperties

      Mono<com.azure.cosmos.models.CosmosContainerProperties> getContainerProperties(String containerName)
      Get properties for specified container
      Parameters:
      containerName - String
      Returns:
      CosmosContainerProperties
    • replaceContainerProperties

      Mono<com.azure.cosmos.models.CosmosContainerProperties> replaceContainerProperties(String containerName, com.azure.cosmos.models.CosmosContainerProperties properties)
      Replace container properties for the specified container
      Parameters:
      containerName - String
      properties - CosmosContainerProperties
      Returns:
      CosmosContainerProperties
    • findAll

      <T> Flux<T> findAll(String containerName, Class<T> domainType)
      Find all items in a given container
      Type Parameters:
      T - type of domainType
      Parameters:
      containerName - the containerName
      domainType - the domainType
      Returns:
      Flux of results
    • findAll

      <T> Flux<T> findAll(Class<T> domainType)
      Find all items in a given container
      Type Parameters:
      T - type of domainType
      Parameters:
      domainType - the domainType
      Returns:
      Flux of results
    • findAll

      <T> Flux<T> findAll(com.azure.cosmos.models.PartitionKey partitionKey, Class<T> domainType)
      Find all items in a given container with partition key
      Type Parameters:
      T - type of domainType
      Parameters:
      partitionKey - partition Key
      domainType - the domainType
      Returns:
      Flux of results
    • findById

      <T> Mono<T> findById(Object id, Class<T> domainType)
      Find by id
      Type Parameters:
      T - type of domainType
      Parameters:
      id - the id
      domainType - the domainType
      Returns:
      Mono of result
    • findById

      <T> Mono<T> findById(String containerName, Object id, Class<T> domainType)
      Find by id
      Type Parameters:
      T - type of domainType
      Parameters:
      containerName - the containername
      id - the id
      domainType - type class
      Returns:
      Mono of result
    • findById

      <T> Mono<T> findById(Object id, Class<T> domainType, com.azure.cosmos.models.PartitionKey partitionKey)
      Find by id
      Type Parameters:
      T - type of domainType
      Parameters:
      id - the id
      domainType - type class
      partitionKey - partition Key
      Returns:
      Mono of result
    • insert

      <T> Mono<T> insert(T objectToSave, com.azure.cosmos.models.PartitionKey partitionKey)
      Insert
      Type Parameters:
      T - type of inserted objectToSave
      Parameters:
      objectToSave - the object to save
      partitionKey - the partition key
      Returns:
      Mono of result
    • insert

      <T> Mono<T> insert(String containerName, T objectToSave, com.azure.cosmos.models.PartitionKey partitionKey)
      Insert
      Type Parameters:
      T - type of inserted objectToSave
      Parameters:
      containerName - the container name
      objectToSave - the object to save
      partitionKey - the partition key
      Returns:
      Mono of result
    • insert

      <T> Mono<T> insert(String containerName, T objectToSave)
      Insert
      Type Parameters:
      T - type class of domain type
      Parameters:
      containerName - must not be null
      objectToSave - must not be null
      Returns:
      Mono of result
    • insertAll

      <S extends T, T> Flux<S> insertAll(CosmosEntityInformation<T,?> entityInformation, Iterable<S> entities)
      Insert all items with bulk.
      Type Parameters:
      S - type class of domain type
      T - type class of domain type
      Parameters:
      entityInformation - must not be null
      entities - must not be null
      Returns:
      Flux of result
    • insertAll

      <S extends T, T> Flux<S> insertAll(CosmosEntityInformation<T,?> entityInformation, Flux<S> entities)
      Insert all items with bulk.
      Type Parameters:
      S - type class of domain type
      T - type class of domain type
      Parameters:
      entityInformation - must not be null
      entities - must not be null
      Returns:
      Flux of result
    • patch

      <T> Mono<T> patch(Object id, com.azure.cosmos.models.PartitionKey partitionKey, Class<T> domainType, com.azure.cosmos.models.CosmosPatchOperations patchOperations)
      patches item
      Type Parameters:
      T - type class of domain type
      Parameters:
      id - must not be null
      partitionKey - must not be null
      domainType - must not be null
      patchOperations - must not be null, max operations is 10
      Returns:
      the patched item
    • patch

      <T> Mono<T> patch(Object id, com.azure.cosmos.models.PartitionKey partitionKey, Class<T> domainType, com.azure.cosmos.models.CosmosPatchOperations patchOperations, com.azure.cosmos.models.CosmosPatchItemRequestOptions options)
      patches item
      Type Parameters:
      T - type class of domain type
      Parameters:
      id - must not be null
      partitionKey - must not be null
      domainType - must not be null
      patchOperations - must not be null, max operations is 10
      options - Optional CosmosPatchItemRequestOptions, e.g. options.setFilterPredicate("FROM products p WHERE p.used = false");
      Returns:
      Mono with the patched item
    • upsert

      <T> Mono<T> upsert(T object)
      Upsert an item with partition key
      Type Parameters:
      T - type class of object
      Parameters:
      object - the object to upsert
      Returns:
      Mono of result
    • upsert

      <T> Mono<T> upsert(String containerName, T object)
      Upsert an item to container with partition key
      Type Parameters:
      T - type class of object
      Parameters:
      containerName - the container name
      object - the object to save
      Returns:
      Mono of result
    • deleteById

      Mono<Void> deleteById(String containerName, Object id, com.azure.cosmos.models.PartitionKey partitionKey)
      Delete an item by id
      Parameters:
      containerName - the container name
      id - the id
      partitionKey - the partition key
      Returns:
      void Mono
    • deleteEntity

      <T> Mono<Void> deleteEntity(String containerName, T entity)
      Delete using entity
      Type Parameters:
      T - type class of domain type
      Parameters:
      containerName - the container name
      entity - the entity object
      Returns:
      void Mono
    • deleteEntities

      <S extends T, T> Mono<Void> deleteEntities(CosmosEntityInformation<T,?> entityInformation, Iterable<S> entities)
      Delete all items with bulk.
      Type Parameters:
      S - type class of domain type
      T - type class of domain type
      Parameters:
      entityInformation - must not be null
      entities - must not be null
      Returns:
      void Mono
    • deleteEntities

      <S extends T, T> Mono<Void> deleteEntities(CosmosEntityInformation<T,?> entityInformation, Flux<S> entities)
      Delete all items with bulk.
      Type Parameters:
      S - type class of domain type
      T - type class of domain type
      Parameters:
      entityInformation - must not be null
      entities - must not be null
      Returns:
      void Mono
    • deleteAll

      Mono<Void> deleteAll(String containerName, Class<?> domainType)
      Delete all items in a container. Uses bulk if possible.
      Parameters:
      containerName - the container name
      domainType - the domainType
      Returns:
      void Mono
    • deleteContainer

      void deleteContainer(String containerName)
      Delete container
      Parameters:
      containerName - the container name
    • delete

      <T> Flux<T> delete(CosmosQuery query, Class<T> domainType, String containerName)
      Delete items matching query
      Type Parameters:
      T - type class of domainType
      Parameters:
      query - the document query
      domainType - type class
      containerName - the container name
      Returns:
      Flux of results
    • find

      <T> Flux<T> find(CosmosQuery query, Class<T> domainType, String containerName)
      Find items
      Type Parameters:
      T - type class of domainType
      Parameters:
      query - the document query
      domainType - type class
      containerName - the container name
      Returns:
      Flux of results
    • exists

      Mono<Boolean> exists(CosmosQuery query, Class<?> domainType, String containerName)
      Exists
      Parameters:
      query - the document query
      domainType - type class
      containerName - the container name
      Returns:
      Mono of result
    • existsById

      Mono<Boolean> existsById(Object id, Class<?> domainType, String containerName)
      Exists
      Parameters:
      id - the id
      domainType - type class
      containerName - the container name
      Returns:
      Mono of result
    • count

      Mono<Long> count(String containerName)
      Count
      Parameters:
      containerName - the container name
      Returns:
      Mono of result
    • count

      Mono<Long> count(CosmosQuery query, String containerName)
      Count
      Parameters:
      query - the document query
      containerName - the container name
      Returns:
      Mono of result
    • count

      Mono<Long> count(com.azure.cosmos.models.SqlQuerySpec querySpec, String containerName)
      Count
      Parameters:
      querySpec - the document query spec
      containerName - the container name
      Returns:
      Mono of result
    • sum

      Mono<Long> sum(com.azure.cosmos.models.SqlQuerySpec querySpec, String containerName)
      Sum
      Parameters:
      querySpec - the document query spec
      containerName - the container name
      Returns:
      sum result
    • getConverter

      MappingCosmosConverter getConverter()
      To get converter
      Returns:
      MappingCosmosConverter
    • runQuery

      <T> Flux<T> runQuery(com.azure.cosmos.models.SqlQuerySpec querySpec, Class<?> domainType, Class<T> returnType)
      Run the query.
      Type Parameters:
      T - the type parameter
      Parameters:
      querySpec - the query spec
      domainType - the domain type
      returnType - the return type
      Returns:
      the flux
    • runQuery

      <T> Flux<T> runQuery(com.azure.cosmos.models.SqlQuerySpec querySpec, org.springframework.data.domain.Sort sort, Class<?> domainType, Class<T> returnType)
      Run the query.
      Type Parameters:
      T - the type parameter
      Parameters:
      querySpec - the query spec
      sort - the sort order
      domainType - the domain type
      returnType - the return type
      Returns:
      the flux