-
Notifications
You must be signed in to change notification settings - Fork 37
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
add distinct_on option for queries #145
Comments
why cant you use the order by and first 1 in the graphql aka like below?
|
I want to get a list of "most recent" games, not a single game. In my case a What I would like to do (see distinct_on param): query GetGames {
allGameEvents(first: 10 offset: 0 orderBy: [BLOCK_NUMBER_DESC], distinct_on: [game_id]) {
nodes {
gamedId
blockNumber
state
}
totalCount
}
} Without this, we have currently these limitations:
When I want to fetch let's say most recent 3 unique games for my pagination so I set
After filtering this list will be:
So my pagination breaks. |
maybe custom queries could be an option? https://www.graphile.org/postgraphile/custom-queries/ Update: yep, solved it with custom queries:
|
My project emits Event like this:
emit StateChanged(gameId, state);
I want to be able to query the most-recent event for a
gameId
. For example Hasura solves this withdistinct_on
query parameters.I think that would be a great addition.
My current workaround is, to query all sorted and then do the filtering client side. This adds a lot of traffic overhead of course.
Or maybe there is another solution that I'm not aware of?
The text was updated successfully, but these errors were encountered: