Closed frederikhors closed 2 years ago
Hey @frederikhors so sorry for the really late response. Tough times back then. I'm back and alive now.
Yes, this way is already better. The core logic is already encapsulated in usecease/service layer. The idea is to keep them loose coupling; you did a great job there.
I'm closing this issue for cleanness' sake. Let's have a proper discussion on Linkedin/Twitter or directly to my email.
Thanks
I'm trying to use the amazing GqlGen (https://github.com/99designs/gqlgen) with your amazing project (thanks again for your work).
I created a PR (https://github.com/bxcodec/go-clean-arch/pull/39) for this integration (which you should not accept, it was a mistake: I just wanted to link here my forked branch!).
Is
gqlgen
in this case just a "third party" delivery layer?I don't know if I'm doing this well: I'm using just
graphql
dir in root!Because - as you can see - code is generated I can just inject
usecases
inmain.go
for thegraphql.Resolver{}
:and I use that usecases in
resolver.go
:What do you think about?
Am I respecting the principles of "clean architecture"?
Is there a more elegant solution?
A more extensive example of gqlgen in action can be found here: https://github.com/oshalygin/gqlgen-pg-todo-example. As you can see he's injecting
db *pg.DB
inmain.go
file for