Created
September 6, 2021 18:12
-
-
Save percybolmer/b3178995cd5405ede82f10e3fc851544 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
package schemas | |
import "github.com/graphql-go/graphql" | |
// GopherType is the gopher graphQL Object that we will send on queries | |
// Here we define the structure of the gopher | |
// This has to match the STRUCT tags that are sent out later | |
var GopherType = graphql.NewObject(graphql.ObjectConfig{ | |
Name: "Gopher", | |
// Fields is the field values to declare the structure of the object | |
Fields: graphql.Fields{ | |
"id": &graphql.Field{ | |
Type: graphql.ID, | |
Description: "The ID that is used to identify unique gophers", | |
}, | |
"name": &graphql.Field{ | |
Type: graphql.String, | |
Description: "The name of the gopher", | |
}, | |
"hired": &graphql.Field{ | |
Type: graphql.Boolean, | |
Description: "True if the Gopher is employeed", | |
}, | |
"profession": &graphql.Field{ | |
Type: graphql.String, | |
Description: "The gophers last/current profession", | |
}, | |
}, | |
}) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment