Open gepgecici opened 1 year ago
You could do something like that, but the generated code would be separated in models and executable schema, however you can always make the actual resolver implementation in as many files as you like and achieve the same result.
For example: model_gen.go executable_schema_gen.go todo.graphql todo.resolver.graphql product.graphql product.resolver.go shipping.graphql shipping.resolver.go
Here is a personal project of mine in which i separated the resolver implementations in their own packages https://github.com/UnAfraid/wg-ui/blob/master/pkg/api/config.go
I would like to put each module/feature/service to its own folder. I couldn't figure out it. Generatted code is not important for me.
NOTE: I update the first message to make it clearer.
I have the same concern as you. I tried many ways in the gqlgen.yml file but It seems that we can not configure to generate .resolver.go file in different folders. @gepgecici Generating all of .grahqls and *.resolver.go in the same folder is not good enough for code management and maintenance. Maybe we have to write a shell script to generate them in different folders so that we can modularize features, but not easy. Does anyone have any way? Or Am I missing something?
I have the same concern as you. I tried many ways in the gqlgen.yml file but It seems that we can not configure to generate .resolver.go file in different folders. @gepgecici Generating all of .grahqls and *.resolver.go in the same folder is not good enough for code management and maintenance. Maybe we have to write a shell script to generate them in different folders so that we can modularize features, but not easy. Does anyone have any way? Or Am I missing something?
If you turn off the automatic resolver generation you can make the resolvers in as many folders as you want, all gqlgen does is simply generate the interfaces for you, you can implement them from wherever you want, if you look few comments above in my previous comment there is a link to a personal project of mine in which i did exactly that.
I'm trying to modularize my application. I want to do something like below. Is that possible with configs?