Created
August 11, 2019 18:21
-
-
Save gufranmirza/0ddd193b124a689dd900d8cec4c79f9f to your computer and use it in GitHub Desktop.
This file contains 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
"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