Interface AsyncRepositoryOperations

All Known Implementing Classes:
AsyncFromReactiveAsyncRepositoryOperation, ExecutorAsyncOperations, ReactorToAsyncOperationsAdaptor

public interface AsyncRepositoryOperations
Asynchronous operations for reading data from a backing implementations.
Since:
1.0.0
Author:
graemerocher
  • Method Details

    • getExecutor

      @NonNull @NonNull Executor getExecutor()
      Returns:
      The executor used by this async operations
    • findOne

      @NonNull <T> @NonNull CompletionStage<T> findOne(@NonNull @NonNull Class<T> type, @NonNull @NonNull Object id)
      Find one by ID.
      Type Parameters:
      T - The generic type
      Parameters:
      type - The type
      id - The id
      Returns:
      A completion stage that emits the result
    • exists

      <T> CompletionStage<Boolean> exists(@NonNull @NonNull PreparedQuery<T,Boolean> preparedQuery)
      Check with an record exists for the given query.
      Type Parameters:
      T - The declaring type
      Parameters:
      preparedQuery - The query
      Returns:
      True if it exists
    • findOne

      @NonNull <T, R> @NonNull CompletionStage<R> findOne(@NonNull @NonNull PreparedQuery<T,R> preparedQuery)
      Find one by Query.
      Type Parameters:
      T - The generic resultType
      R - The result type
      Parameters:
      preparedQuery - The prepared query
      Returns:
      A completion stage that emits the result
    • findOptional

      @NonNull <T> @NonNull CompletionStage<T> findOptional(@NonNull @NonNull Class<T> type, @NonNull @NonNull Object id)
      Find one by ID.
      Type Parameters:
      T - The generic type
      Parameters:
      type - The type
      id - The id
      Returns:
      A completion stage that emits the result or null if there is no result
    • findOptional

      @NonNull <T, R> @NonNull CompletionStage<R> findOptional(@NonNull @NonNull PreparedQuery<T,R> preparedQuery)
      Find one by Query.
      Type Parameters:
      T - The generic resultType
      R - The result type
      Parameters:
      preparedQuery - The prepared query
      Returns:
      A completion stage that emits the result or null if there is no result
    • findAll

      @NonNull <T> @NonNull CompletionStage<Iterable<T>> findAll(PagedQuery<T> pagedQuery)
      Finds all results for the given query.
      Type Parameters:
      T - The generic type
      Parameters:
      pagedQuery - The paged query
      Returns:
      A completion stage that emits the results
    • count

      @NonNull <T> @NonNull CompletionStage<Long> count(PagedQuery<T> pagedQuery)
      Counts all results for the given query.
      Type Parameters:
      T - The generic type
      Parameters:
      pagedQuery - The paged query
      Returns:
      A completion stage that emits the count as a long
    • findAll

      @NonNull <T, R> @NonNull CompletionStage<Iterable<R>> findAll(@NonNull @NonNull PreparedQuery<T,R> preparedQuery)
      Finds all results for the given query.
      Type Parameters:
      T - The entity type
      R - The result type
      Parameters:
      preparedQuery - The prepared query
      Returns:
      A completion stage that emits an iterable with all results
    • persist

      @NonNull <T> @NonNull CompletionStage<T> persist(@NonNull @NonNull InsertOperation<T> operation)
      Persist the entity returning a possibly new entity.
      Type Parameters:
      T - The generic type
      Parameters:
      operation - The entity operation
      Returns:
      A completion stage that emits the entity
    • update

      @NonNull <T> @NonNull CompletionStage<T> update(@NonNull @NonNull UpdateOperation<T> operation)
      Updates the entity returning a possibly new entity.
      Type Parameters:
      T - The generic type
      Parameters:
      operation - The entity operation
      Returns:
      A completion stage that emits the entity
    • updateAll

      @NonNull default <T> @NonNull CompletionStage<Iterable<T>> updateAll(@NonNull @NonNull UpdateBatchOperation<T> operation)
      Updates the entities for the given operation.
      Type Parameters:
      T - The generic type
      Parameters:
      operation - The operation
      Returns:
      The updated entities
    • delete

      @SingleResult @NonNull <T> @NonNull CompletionStage<Number> delete(@NonNull @NonNull DeleteOperation<T> operation)
      Deletes the entity.
      Type Parameters:
      T - The generic type
      Parameters:
      operation - The batch operation
      Returns:
      A publisher that emits the number of entities deleted
    • persistAll

      @NonNull <T> @NonNull CompletionStage<Iterable<T>> persistAll(@NonNull @NonNull InsertBatchOperation<T> operation)
      Persist all the given entities.
      Type Parameters:
      T - The generic type
      Parameters:
      operation - The batch operation
      Returns:
      The entities, possibly mutated
    • executeUpdate

      @NonNull @NonNull CompletionStage<Number> executeUpdate(@NonNull @NonNull PreparedQuery<?,Number> preparedQuery)
      Executes an update for the given query and parameter values. If it is possible to return the number of objects updated, then do so.
      Parameters:
      preparedQuery - The prepared query
      Returns:
      A completion that emits a boolean true if successful
    • executeDelete

      @NonNull default @NonNull CompletionStage<Number> executeDelete(@NonNull @NonNull PreparedQuery<?,Number> preparedQuery)
      Executes a delete batch for the given query and parameter values. If it is possible to return the number of objects updated, then do so.
      Parameters:
      preparedQuery - The prepared query
      Returns:
      A completion that emits a boolean true if successful
    • deleteAll

      @NonNull <T> @NonNull CompletionStage<Number> deleteAll(@NonNull @NonNull DeleteBatchOperation<T> operation)
      Deletes all the entities of the given type.
      Type Parameters:
      T - The generic type
      Parameters:
      operation - The batch operation
      Returns:
      A completion that emits a boolean true if successful
    • findPage

      @NonNull <R> @NonNull CompletionStage<Page<R>> findPage(@NonNull @NonNull PagedQuery<R> pagedQuery)
      Find a page for the given entity and pageable.
      Type Parameters:
      R - The entity generic type
      Parameters:
      pagedQuery - The paged query
      Returns:
      The page type