-
Notifications
You must be signed in to change notification settings - Fork 843
Question: How to read the requested fields in Resolve #125
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
Comments
look at https://godoc.org/github.com/graphql-go/graphql#ResolveParams you can access graphql query variables through |
Thanks @bsr203 but unfortunately this isn't what I'm looking for. So if I had a query:
What you're suggesting is being able to access |
To answer my own question, here's how I solved this: Assume you have the query:
And you want to know whether the
And invoke it like this:
In case you have a "path" you want to select from, e.g.
Then you'd call it like this:
For context, this problem had also been discussed here: graphql/graphql-js#19 as well as mentioned here http://pcarion.com/2015/09/26/graphql-resolve/ |
thank you for posting the solution. I too may want to use it one day, but not there yet. cheers. |
Thanks! I'm going to use this solution. But I still think the library should provide a straightforward way to access this. |
Just an FYI for anyone reading this, I used the same solution, and it breaks if the client uses fragments:
I'll post here when I find a solution to this. |
I've posted my modified solution here, which works for queries that include fragments: #157 (comment) |
I hope this question makes sense, I'm new to graphql...
Anyway, is there a way in the
Resolve
func to access the list of fiends that the user requested?Example:
The text was updated successfully, but these errors were encountered: