graphql-go / graphql-go/graphql

How to either change the context or know the objects to be operating on before a call to `Do(...)`

Open
#280 1 comment 1 reaction 0 assignees View on GitHub
Dominant language
Go
Stars
10.1k
Forks
845
PR merge metrics
No merged PRs in 30d

Description

I have a project where, depending on the objects that the user is querying, may have to do significant processing and/or db lookups. For this reason, it's important to not do all that work for all queries, and so need to either 1) know what objects are being queried before I call `graphql.Do` so that I can do all that processing before getting to the `resolve` functions, or 2) from within the `resolve` functions be able to edit the `Context` (something like `p.Context = Context.WithValue(...)`) so that only the first resolve actually has to do the lookup/processing of all that junk.

Or if there is a different/better way to structure/think of things, that rocks as well. Looking for ideas/brainstormings/etc.

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.