Skip to content

Instantly share code, notes, and snippets.

@percybolmer
Last active September 10, 2021 09:44
Show Gist options
  • Save percybolmer/321d945e63c3a0517e61279afc3b6132 to your computer and use it in GitHub Desktop.
Save percybolmer/321d945e63c3a0517e61279afc3b6132 to your computer and use it in GitHub Desktop.
graphQL
type Resolver interface {
// ResolveGophers should return a list of all gophers in the repository
ResolveGophers(p graphql.ResolveParams) (interface{}, error)
// ResolveGopher is used to respond to single queries for gophers
ResolveGopher(p graphql.ResolveParams) (interface{}, error)
// ResolveJobs is used to find Jobs
ResolveJobs(p graphql.ResolveParams) (interface{}, error)
}
// GopherService is the service that holds all repositories
type GopherService struct {
gophers Repository
// Jobs are reachable by the Repository
jobs job.Repository
}
// NewService is a factory that creates a new GopherService
func NewService(repo Repository, jobrepo job.Repository) GopherService {
return GopherService{
gophers: repo,
jobs: jobrepo,
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment