Interface QueryUtils


public interface QueryUtils
  • Method Details

    • toPublisher

      static <ID, IDC extends Collection<ID>, R> Function<IDC,org.reactivestreams.Publisher<R>> toPublisher(Function<IDC,Iterable<R>> queryFunction)
    • queryOneToOne

      @NotNull static <ID, IDC extends Collection<ID>, R> @NotNull reactor.core.publisher.Mono<Map<ID,R>> queryOneToOne(IDC ids, Function<IDC,org.reactivestreams.Publisher<R>> queryFunction, Function<R,ID> idExtractorFromQueryResults)
    • queryOneToOne

      @NotNull static <ID, IDC extends Collection<ID>, R> @NotNull reactor.core.publisher.Mono<Map<ID,R>> queryOneToOne(IDC ids, Function<IDC,org.reactivestreams.Publisher<R>> queryFunction, Function<R,ID> idExtractorFromQueryResults, MapFactory<ID,R> mapFactory)
    • queryOneToOne

      @NotNull static <ID, IDC extends Collection<ID>, R> @NotNull reactor.core.publisher.Mono<Map<ID,R>> queryOneToOne(IDC ids, Function<IDC,org.reactivestreams.Publisher<R>> queryFunction, Function<R,ID> idExtractorFromQueryResults, Function<ID,R> defaultResultProvider)
    • queryOneToOne

      @NotNull static <ID, IDC extends Collection<ID>, R> @NotNull reactor.core.publisher.Mono<Map<ID,R>> queryOneToOne(IDC ids, Function<IDC,org.reactivestreams.Publisher<R>> queryFunction, Function<R,ID> idExtractorFromQueryResults, Function<ID,R> defaultResultProvider, MapFactory<ID,R> mapFactory)
    • queryOneToManyAsList

      @NotNull static <ID, IDC extends Collection<ID>, R> @NotNull reactor.core.publisher.Mono<Map<ID,List<R>>> queryOneToManyAsList(IDC ids, Function<IDC,org.reactivestreams.Publisher<R>> queryFunction, Function<R,ID> idExtractorFromQueryResults)
    • queryOneToManyAsList

      @NotNull static <ID, IDC extends Collection<ID>, R> @NotNull reactor.core.publisher.Mono<Map<ID,List<R>>> queryOneToManyAsList(IDC ids, Function<IDC,org.reactivestreams.Publisher<R>> queryFunction, Function<R,ID> idExtractorFromQueryResults, MapFactory<ID,List<R>> mapFactory)
    • queryOneToManyAsSet

      @NotNull static <ID, IDC extends Collection<ID>, R> @NotNull reactor.core.publisher.Mono<Map<ID,Set<R>>> queryOneToManyAsSet(IDC ids, Function<IDC,org.reactivestreams.Publisher<R>> queryFunction, Function<R,ID> idExtractorFromQueryResults)
    • queryOneToManyAsSet

      @NotNull static <ID, IDC extends Collection<ID>, R> @NotNull reactor.core.publisher.Mono<Map<ID,Set<R>>> queryOneToManyAsSet(IDC ids, Function<IDC,org.reactivestreams.Publisher<R>> queryFunction, Function<R,ID> idExtractorFromQueryResults, MapFactory<ID,Set<R>> mapFactory)
    • queryOneToMany

      @NotNull static <ID, IDC extends Collection<ID>, R, RC extends Collection<R>> @NotNull reactor.core.publisher.Mono<Map<ID,RC>> queryOneToMany(IDC ids, Function<IDC,org.reactivestreams.Publisher<R>> queryFunction, Function<R,ID> idExtractorFromQueryResults, Supplier<RC> collectionFactory)
    • queryOneToMany

      @NotNull static <ID, IDC extends Collection<ID>, R, RC extends Collection<R>> @NotNull reactor.core.publisher.Mono<Map<ID,RC>> queryOneToMany(IDC ids, Function<IDC,org.reactivestreams.Publisher<R>> queryFunction, Function<R,ID> idExtractorFromQueryResults, Supplier<RC> collectionFactory, MapFactory<ID,RC> mapFactory)
    • query

      @NotNull static <ID, IDC extends Collection<ID>, R, RRC> @NotNull reactor.core.publisher.Mono<Map<ID,RRC>> query(IDC ids, Function<IDC,org.reactivestreams.Publisher<R>> queryFunction, Function<ID,RRC> defaultResultProvider, Collector<R,?,Map<ID,RRC>> mapCollector)
      Type Parameters:
      ID - Type of the ids passed to queryFunction e.g. Long, String
      IDC - Type of the Collection containing the ids of type <ID> e.g. List<Long>, Set<String>, etc. e.g. List<Customer>, Set<Order>, etc.
      R - Type of individual results returned from the queryFunction
      RRC - Type of each value representing the result from queryFunction associated with each ID, will map to either <R> when called from queryOneToOne or <RC> when called from queryOneToMany i.e. a collection of <R>. This is conceptually a union type <R> | <RC>
      Parameters:
      ids - The collection of ids to pass to the queryFunction
      queryFunction - The query function to call (rest call, spring data repository method call, etc.)
      defaultResultProvider - The default value to generate if no result for a specific id passed to the queryFunction e.g. an empty collection, a default value, an empty string, etc.
      mapCollector - The collector used to collect the stream of results returned by queryFunction. It will transform a stream of results to a Map<ID, V>
      Returns:
      A Map of the results from invoking the queryFunction with key = correlation ID, value = result associated with ID
    • safeApply

      @NotNull static <T, R, C extends Iterable<? extends T>> @NotNull reactor.core.publisher.Flux<R> safeApply(C coll, Function<C,org.reactivestreams.Publisher<R>> queryFunction)