schema.go
1package graphql
2
3import "github.com/graphql-go/graphql"
4
5func newGraphqlSchema() (graphql.Schema, error) {
6
7 rootQuery := graphql.ObjectConfig{
8 Name: "RootQuery",
9 Fields: graphql.Fields{
10 "hello": &graphql.Field{
11 Type: graphql.String,
12 },
13 },
14 }
15
16 schemaConfig := graphql.SchemaConfig{
17 Query: graphql.NewObject(rootQuery),
18 }
19
20 return graphql.NewSchema(schemaConfig)
21}