Created
September 9, 2021 11:20
-
-
Save percybolmer/64587fba25772242b8b2d54d3cffb6f5 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
// ResolveJobs is used to find all jobs related to a gopher | |
func (gs *GopherService) ResolveJobs(p graphql.ResolveParams) (interface{}, error) { | |
// Fetch Source Value | |
g, ok := p.Source.(Gopher) | |
if !ok { | |
return nil, errors.New("source was not a Gopher") | |
} | |
// Find Jobs Based on the Gophers ID | |
jobs, err := gs.jobs.GetJobs(g.ID) | |
if err != nil { | |
return nil, err | |
} | |
return jobs, nil | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment