The gqlgen
blog post written by Eddy is awesome! It contains a full walk through on building a little app. Will actually go ahead and implement this next week in 99time.
Some things that came out of the implementation of the code:
-
A couple of times when running
go generate ./...
thegenerated.go
file wasn't being generated at all due to some kind of error in the resolvers or graphqls files, basically when this happens look at the changes you've made and maybe roll back to what you had before, check if those changes you made previously had some errors -
The
@goModel
directive did a few things that I think I understand better now, passing the string to a GraphQL type then ensures that when any queries related to this type resolve you're still only getting back the fields defined in this type, even if the fields in the model (defined in Go) are different -
When running the
gqlgen
command you often just get function signatures automatically, when using the directive received signatures forLastName
andFullName
-
There's still some syntax that I don't fully grasp in Go, especially imports and exports, pointers
-
It would potentially be good practise to learn a Go ORM and deploy that to something like Heroku, maybe learn some of the low level SQL drivers that Go has, I presume I could use a basic implementation like this but instead of in memory data using a real database