Class QuerydslDataFetcher<T>

java.lang.Object
org.springframework.graphql.data.query.QuerydslDataFetcher<T>
Type Parameters:
T - returned result type

public abstract class QuerydslDataFetcher<T> extends Object
Main class to create a DataFetcher from a Querydsl repository. To create an instance, use one of the following:

For example:

 interface BookRepository extends
         Repository<Book, String>, QuerydslPredicateExecutor<Book>{}

 TypeRuntimeWiring wiring = … ;
 BookRepository repository = … ;

 DataFetcher<?> forMany =
         wiring.dataFetcher("books", QuerydslDataFetcher.builder(repository).many());

 DataFetcher<?> forSingle =
         wiring.dataFetcher("book", QuerydslDataFetcher.builder(repository).single());
 

See QuerydslDataFetcher.Builder and QuerydslDataFetcher.ReactiveBuilder methods for further options on GraphQL Query argument to Querydsl Predicate binding customizations, result projections, and sorting.

QuerydslDataFetcher exposes a RuntimeWiringConfigurer that can auto-register repositories annotated with @GraphQlRepository.

Since:
1.0.0
Author:
Mark Paluch, Rossen Stoyanchev
See Also: