Defer execution of selection set to root resolver #2600
Unanswered
kevinmichaelchen
asked this question in
Q&A
Replies: 1 comment
-
This kind of deferred aggregation seems possible with Data Loaders 🤔 |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
What I currently have
I have a "bulk" mutation like the following:
According to the GraphQL spec,
createFoo
andcreateBar
will be executed in sequence.Each of these is handled by separate resolvers, each of which create separate database transactions behind the scenes.
What I'd like to see
Rather than separate transactions, I'd like one transaction.
This seems theoretically possible by deferring execution to the root resolver, which can "inspect" the selection set, determine which mutations the client would like to execute, and build one DB transaction.
Are there examples of how to do this?
I'm trying to build one here: https://github.com/kevinmichaelchen/go-gqlgen-deferred-execution-example
Beta Was this translation helpful? Give feedback.
All reactions