Skip to content

Instantly share code, notes, and snippets.

View gufranmirza's full-sized avatar

Gufran Mirza gufranmirza

View GitHub Profile
#!/bin/sh
set -eufo pipefail
if [ "$#" -ne 2 ]; then
echo "usage: $0 source_repo_url target_repo_url" >&2
exit 1
fi
SOURCE_URL="$1"
package main
import (
"encoding/json"
"net/http"
"log"
"github.com/graphql-go/graphql"
)
"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{
package main
import (
"encoding/json"
"net/http"
"log"
"github.com/graphql-go/graphql"
)
rootQuery := graphql.NewObject(graphql.ObjectConfig{
Name: "Query",
Fields: graphql.Fields{
"songs": &graphql.Field{
Type: graphql.NewList(songType),
Resolve: func(params graphql.ResolveParams) (interface{}, error) {
return nil, nil
},
},
},
albumType := graphql.NewObject(graphql.ObjectConfig{
Name: "Album",
Fields: graphql.Fields{
"id": &graphql.Field{
Type: graphql.String,
},
"artist": &graphql.Field{
Type: graphql.String,
},
"title": &graphql.Field{
artistType := graphql.NewObject(graphql.ObjectConfig{
Name: "Artist",
Fields: graphql.Fields{
"id": &graphql.Field{
Type: graphql.String,
},
"name": &graphql.Field{
Type: graphql.String,
},
"type": &graphql.Field{
songType := graphql.NewObject(graphql.ObjectConfig{
Name: "Song",
Fields: graphql.Fields{
"id": &graphql.Field{
Type: graphql.String,
},
"album": &graphql.Field{
Type: graphql.String,
},
"title": &graphql.Field{
var albums []Album = []Album{
Album{
ID: "ts-fearless",
Artist: "1",
Title: "Fearless",
Year: "2008",
Type: "album",
},
}
package main
import (
"encoding/json"
"net/http"
"github.com/graphql-go/graphql"
)
type Album struct {