nrc / graphql

A Rust GraphQL server framework
Apache License 2.0
236 stars 12 forks source link

Would it be possilbe to get the requested fields on a model? #33

Open triptec opened 6 years ago

triptec commented 6 years ago

.. so that I don't need to "select * from heroes" when only the name of example is requested?

nrc commented 6 years ago

It is possible, you need to implement a custom Hero type with just the fields you want and then implement the various traits so that it plugs in nicely. You should be able to read the context to find the rest of the query and thus whether you need all the fields or just some. I don't think that is implemented yet, but it might be in a sub-optimal way.

For completeness: