Replies: 1 comment
-
The best technique I've come up with thus far is to attach a metadata bag to every model using modelgen, but it would be kinda nice if there were a way to declare perhaps a standard set of typed fields that every model struct should have in addition to their output fields. |
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 happened?
I would like to write (forced) child resolvers that have access to data (e.g. database rows) obtained in a parent resolver that are not represented in the autogenerated struct model. This is trivial in dynamic languages with their malleable types and the reference resolver type signature.
I believe I can manually create the model structs with extra fields for which I want this capability, but I feel like I'm giving up on the
gen
part ofgqlgen
when I do so. I do not know if it would be safe to add arbitrary keys to thectx
argument, asgqlgen
is not clear on how, if it all, it may safely be mutated during a query.What did you expect?
I expected an affordance for this reasonably common advanced usage. I might imagine some declarations in the
models
portion ofgqlgen.yml
or some documented safe usage ofctx
for this purpose.versions
gqlgen version
?v0.13.0
go version
?1.16
Beta Was this translation helpful? Give feedback.
All reactions