types.go

 1package graphql
 2
 3import "github.com/graphql-go/graphql"
 4
 5// Internally, it's the Snapshot
 6var bugType = graphql.NewObject(graphql.ObjectConfig{
 7	Name: "Bug",
 8	Fields: graphql.Fields{
 9		"id": &graphql.Field{
10			Type: graphql.String,
11		},
12		"status": &graphql.Field{
13			Type: graphql.String,
14		},
15		"comments": &graphql.Field{
16			Type: graphql.NewList(commentType),
17		},
18		"labels": &graphql.Field{
19			Type: graphql.NewList(graphql.String),
20		},
21		// TODO: operations
22	},
23})
24
25var commentType = graphql.NewObject(graphql.ObjectConfig{
26	Name: "Comment",
27	Fields: graphql.Fields{
28		"author": &graphql.Field{
29			Type: personType,
30		},
31		"message": &graphql.Field{
32			Type: graphql.String,
33		},
34		// TODO: time
35	},
36})
37
38var personType = graphql.NewObject(graphql.ObjectConfig{
39	Name: "Person",
40	Fields: graphql.Fields{
41		"name": &graphql.Field{
42			Type: graphql.String,
43		},
44		"email": &graphql.Field{
45			Type: graphql.String,
46		},
47	},
48})