Skip to content

Instantly share code, notes, and snippets.

@gufranmirza gufranmirza/main.go
Created Aug 11, 2019

Embed
What would you like to do?
"createSong": &graphql.Field{
Type: songType,
Args: graphql.FieldConfigArgument{
"id": &graphql.ArgumentConfig{
Type: graphql.NewNonNull(graphql.String),
},
"album": &graphql.ArgumentConfig{
Type: graphql.NewNonNull(graphql.String),
},
"title": &graphql.ArgumentConfig{
Type: graphql.NewNonNull(graphql.String),
},
"duration": &graphql.ArgumentConfig{
Type: graphql.NewNonNull(graphql.String),
},
},
Resolve: func(params graphql.ResolveParams) (interface{}, error) {
var song Song
song.ID = params.Args["id"].(string)
song.Album = params.Args["album"].(string)
song.Title = params.Args["title"].(string)
song.Duration = params.Args["duration"].(string)
songs = append(songs, song)
return song, nil
},
},
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.