Created
August 3, 2018 14:12
-
-
Save koblas/a5f3badbc502330e1c7ab149c36b88e2 to your computer and use it in GitHub Desktop.
GraphQL Scheme base
This file contains 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 nresolver | |
import ( | |
"github.com/graphql-go/graphql" | |
) | |
var queryConfig = graphql.NewObject(graphql.ObjectConfig{ | |
Name: "Query", | |
// Must initialize to an empty set | |
Fields: graphql.Fields{}, | |
}) | |
var mutationConfig = graphql.NewObject(graphql.ObjectConfig{ | |
Name: "Mutation", | |
// Must initialize to an empty set | |
Fields: graphql.Fields{}, | |
}) | |
// GetSchema returns the constructed graphql schema | |
func GetSchema() *graphql.Schema { | |
var schema graphql.Schema | |
schema, err := graphql.NewSchema(graphql.SchemaConfig{ | |
Query: queryConfig, | |
Mutation: mutationConfig, | |
}) | |
if err != nil { | |
panic(err) | |
} | |
return &schema | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment