Open clarkmcc opened 3 months ago
You should be able to handle this using Go's context.Context type. See this explanation:
One benefit of using
context.Context
in a program is the ability to access data stored inside a context. By adding data to a context and passing the context from function to function, each layer of a program can add additional information about what’s happening.
In other words, you can have resolvers A and B add their IDs to the context, and then resolver C can look up those IDs. I hope this helps, and others can correct me if there's a better pattern.
In the following example, I want to resolve the
value
inC
, but I need the IDs of bothA
andB
to do it.p.Source
only gives meB
, but notA
. What is the proper way to solve this problem?