diff --git a/README.md b/README.md index 597cac3..13bfa65 100644 --- a/README.md +++ b/README.md @@ -389,7 +389,7 @@ kumuluzee: enabled: true ``` -This will add a counter and a timer to every query and mutation in the application. For a more fine grained control +This will add a counter and a timer to every query and mutation in the application. For a more fine-grained control over metrics you can always use metrics annotations on your query/mutation methods. For example: ```java @@ -442,6 +442,51 @@ public class Customer { } ``` +## Integration with kumuluzee-rest + +You can use the standard [kumuluzee-rest](https://github.com/kumuluz/kumuluzee-rest) parameters (pagination/sort/filter) +in GraphQL queries by using the `GraphQLUtils.queryParametersBuilder()` to construct `QueryParameters` +which can then be used by _kumuluzee-rest_. + +For example: + +```java +@Query +public StudentConnection getStudentsConnection(Long limit, Long offset, String sort, String filter) { + + QueryParameters qp = GraphQLUtils.queryParametersBuilder() + .withQueryStringDefaults(qsd) + .withLimit(limit) + .withOffset(offset) + .withOrder(sort) + .withFilter(filter) + .build(); + + return new StudentConnection(JPAUtils.queryEntities(em, Student.class, qp), + JPAUtils.queryEntitiesCount(em, Student.class, qp)); +} +``` + +Query: + +```graphql +query StudentsStartingWithJ { + studentsConnection( + offset: "0" + limit: "10" + sort: "studentNumber" + filter: "name:LIKE:J%" + ) { + totalCount + edges { + studentNumber + name + surname + } + } +} +``` + ## Changelog Recent changes can be viewed on Github on the [Releases Page](https://github.com/kumuluz/kumuluzee-graphql/releases).