Skip to content
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

Question: Access selected fields in resolver #27

Closed
jbub opened this issue Feb 23, 2018 · 2 comments · Fixed by #65
Closed

Question: Access selected fields in resolver #27

jbub opened this issue Feb 23, 2018 · 2 comments · Fixed by #65
Labels
enhancement New feature or request

Comments

@jbub
Copy link

jbub commented Feb 23, 2018

Hello, first thank you for a great project! Great job!

I have a question, say i am using postgres as my datasource for resolvers and i want to take advantage of the fact that graphql allows us to select subset of fields. So i want to just query fields i need to optimize the query.

Now how would i go about that when implementing resolvers for example:

query findTodos {
  todos {
    text
    done
  }
}
func (r *TodoResolver) Query_todos(ctx context.Context) ([]Todo, error) {
    // how do i access which of the fields were selected in the query here
    rows, err := r.db.Query("SELECT text, done FROM todos")
}

Thank you for any pointers :) Keep up the great job!

@vektah
Copy link
Collaborator

vektah commented Feb 26, 2018

Sorry, This isn't currently being exposed, but it will get added shortly for Schema stitching.

@jbub
Copy link
Author

jbub commented Feb 26, 2018

Thank you :)

@vektah vektah added the enhancement New feature or request label Mar 8, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants