Raj
Raj

Reputation: 4079

How to support ordering in GraphqlJava queries

I am not able to find anything that relates to how a response of a query can be ordered using a date.

I want to be able to send an ordered response rather than make the front end make the query that needs ordering.

Upvotes: 0

Views: 233

Answers (1)

Ken Chan
Ken Chan

Reputation: 90437

It is nothing that graphql-java will help you. It all depends on the underlying technology and the implementation of the resolver of that root query field. If you are getting the data from DB, you can rely on the SQL ORDER BY. The point is that it the responsibility of the developer to make sure the list of data returned from the resolver is already sorted by a certain order.

If an user does not specify any sort order input argument in the query , you can consider that it means he want the result to be sorted in a some default order.

Upvotes: 1

Related Questions