diff options
Diffstat (limited to 'graphql/schema.go')
-rw-r--r-- | graphql/schema.go | 18 |
1 files changed, 11 insertions, 7 deletions
diff --git a/graphql/schema.go b/graphql/schema.go index f6523f03..f8fb9768 100644 --- a/graphql/schema.go +++ b/graphql/schema.go @@ -3,15 +3,19 @@ package graphql import "github.com/graphql-go/graphql" func graphqlSchema() (graphql.Schema, error) { - fields := graphql.Fields{ - "hello": &graphql.Field{ - Type: graphql.String, - Resolve: func(p graphql.ResolveParams) (interface{}, error) { - return "world", nil + + rootQuery := graphql.ObjectConfig{ + Name: "RootQuery", + Fields: graphql.Fields{ + "hello": &graphql.Field{ + Type: graphql.String, }, }, } - rootQuery := graphql.ObjectConfig{Name: "RootQuery", Fields: fields} - schemaConfig := graphql.SchemaConfig{Query: graphql.NewObject(rootQuery)} + + schemaConfig := graphql.SchemaConfig{ + Query: graphql.NewObject(rootQuery), + } + return graphql.NewSchema(schemaConfig) } |