Class QueryByExampleDataFetcher.ReactiveBuilder<T,R>
java.lang.Object
org.springframework.graphql.data.query.QueryByExampleDataFetcher.ReactiveBuilder<T,R>
- Type Parameters:
T
- domain typeR
- result type
- Enclosing class:
- QueryByExampleDataFetcher<T>
Builder for a reactive Query by Example-based
DataFetcher
.
Note that builder instances are immutable and return a new instance of
the builder when calling configuration methods.-
Method Summary
Modifier and TypeMethodDescriptioncursorStrategy
(CursorStrategy<org.springframework.data.domain.ScrollPosition> cursorStrategy) Configure strategy for decoding a cursor from a paginated request.defaultScrollSubrange
(int defaultCount, Function<Boolean, org.springframework.data.domain.ScrollPosition> defaultPosition) Configure a default scroll count to use, and function to return a defaultScrollPosition
for forward vs backward pagination.defaultScrollSubrange
(ScrollSubrange defaultSubrange) Deprecated, for removal: This API element is subject to removal in a future version.DataFetcher<reactor.core.publisher.Flux<R>>
many()
Build aDataFetcher
to fetch many object instances.Project results returned from theReactiveQueryByExampleExecutor
into the targetprojectionType
.DataFetcher<reactor.core.publisher.Mono<Iterable<R>>>
Build aDataFetcher
that scrolls and returnsWindow
.DataFetcher<reactor.core.publisher.Mono<R>>
single()
Build aDataFetcher
to fetch single object instances.sortBy
(org.springframework.data.domain.Sort sort) Apply aSort
order.
-
Method Details
-
projectAs
Project results returned from theReactiveQueryByExampleExecutor
into the targetprojectionType
. Projection types can be either interfaces with property getters to expose or regular classes outside the entity type hierarchy for DTO projections.- Type Parameters:
P
- projection type- Parameters:
projectionType
- projection type- Returns:
- a new
QueryByExampleDataFetcher.ReactiveBuilder
instance with all previously configured options andprojectionType
applied
-
cursorStrategy
public QueryByExampleDataFetcher.ReactiveBuilder<T,R> cursorStrategy(@Nullable CursorStrategy<org.springframework.data.domain.ScrollPosition> cursorStrategy) Configure strategy for decoding a cursor from a paginated request.By default, this is
ScrollPositionCursorStrategy
withCursorEncoder.base64()
encoding.- Parameters:
cursorStrategy
- the strategy to use- Returns:
- a new
QueryByExampleDataFetcher.Builder
instance with all previously configured options andSort
applied - Since:
- 1.2.0
-
defaultScrollSubrange
public QueryByExampleDataFetcher.ReactiveBuilder<T,R> defaultScrollSubrange(int defaultCount, Function<Boolean, org.springframework.data.domain.ScrollPosition> defaultPosition) Configure a default scroll count to use, and function to return a defaultScrollPosition
for forward vs backward pagination.For offset scrolling, use
ScrollPosition.offset()
to scroll from the beginning. Currently, it is not possible to go back from the end.For keyset scrolling, use
ScrollPosition.keyset()
to scroll from the beginning, orKeysetScrollPosition.reverse()
the same to go back from the end.By default a count of 20 and
ScrollPosition.offset()
are used.- Parameters:
defaultCount
- the default count of elements in the subrangedefaultPosition
- function that returns a defaultScrollPosition
- Since:
- 1.2.5
-
defaultScrollSubrange
@Deprecated(since="1.2.5", forRemoval=true) public QueryByExampleDataFetcher.ReactiveBuilder<T,R> defaultScrollSubrange(@Nullable ScrollSubrange defaultSubrange) Deprecated, for removal: This API element is subject to removal in a future version.in favor ofdefaultScrollSubrange(int, Function)
Configure aScrollSubrange
to use when a paginated request does not specify a cursor and/or a count of items.By default, this is
ScrollPosition.offset()
with a count of 20.- Parameters:
defaultSubrange
- the default scroll subrange- Returns:
- a new
QueryByExampleDataFetcher.Builder
instance with all previously configured options andSort
applied
-
sortBy
public QueryByExampleDataFetcher.ReactiveBuilder<T,R> sortBy(org.springframework.data.domain.Sort sort) Apply aSort
order.- Parameters:
sort
- the default sort order- Returns:
- a new
QueryByExampleDataFetcher.ReactiveBuilder
instance with all previously configured options andSort
applied
-
single
Build aDataFetcher
to fetch single object instances. -
many
Build aDataFetcher
to fetch many object instances. -
scrollable
Build aDataFetcher
that scrolls and returnsWindow
.- Since:
- 1.2.0
-
defaultScrollSubrange(int, Function)