Last active
September 10, 2021 09:44
-
-
Save percybolmer/321d945e63c3a0517e61279afc3b6132 to your computer and use it in GitHub Desktop.
graphQL
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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