View mirror.sh
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
#!/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" |
View main.go
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
package main | |
import ( | |
"encoding/json" | |
"net/http" | |
"log" | |
"github.com/graphql-go/graphql" | |
) |
View main.go
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{ |
View main.go
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
package main | |
import ( | |
"encoding/json" | |
"net/http" | |
"log" | |
"github.com/graphql-go/graphql" | |
) |
View main.go
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
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 | |
}, | |
}, | |
}, |
View main.go
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
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{ |
View main.go
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
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{ |
View main.go
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
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{ |
View main.go
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
var albums []Album = []Album{ | |
Album{ | |
ID: "ts-fearless", | |
Artist: "1", | |
Title: "Fearless", | |
Year: "2008", | |
Type: "album", | |
}, | |
} |
View main.go
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
package main | |
import ( | |
"encoding/json" | |
"net/http" | |
"github.com/graphql-go/graphql" | |
) | |
type Album struct { |
NewerOlder