schema.go

 1package graphql
 2
 3import "github.com/graphql-go/graphql"
 4
 5func graphqlSchema() (graphql.Schema, error) {
 6	fields := graphql.Fields{
 7		"hello": &graphql.Field{
 8			Type: graphql.String,
 9			Resolve: func(p graphql.ResolveParams) (interface{}, error) {
10				return "world", nil
11			},
12		},
13	}
14	rootQuery := graphql.ObjectConfig{Name: "RootQuery", Fields: fields}
15	schemaConfig := graphql.SchemaConfig{Query: graphql.NewObject(rootQuery)}
16	return graphql.NewSchema(schemaConfig)
17}