gqlgen-example
gqlgen-example copied to clipboard
Question: adding new resolvers/services?
Hey there!
Thanks for this sample, really nice and simple, one question though, how can new services be added to the NewResolver
method? https://github.com/alexzimmer96/gqlgen-example/blob/e63752d46e2a7d37e9bd10058e6c3178aed12679/graphql/resolvers.go#L13
it looks like only a single service, in this case articleService passed through, would changing this block to the following do the trick? I'm still new to go but quite familiar with building gql backends with apollo.
type Resolver struct {
articleService service.IArticleService,
someServiceA service.ISomeServiceA,
someServiceB service.ISomeServiceB,
}
func NewResolver() *Resolver {
return &Resolver{
articleService: service.IArticleService,
someServiceA: service.ISomeServiceA,
someServiceB: service.ISomeServiceB,
}
}
Anyway thanks for providing this example
Hi @jay-manday Wow.. I took me more than one year to realize there's actually a Issue in one of my projects. I apol(l)ogize for the late feedback. At least with the version i've used, this should do the trick.