diff options
Diffstat (limited to 'vendor/github.com/vektah/gqlparser/gqlparser.go')
-rw-r--r-- | vendor/github.com/vektah/gqlparser/gqlparser.go | 42 |
1 files changed, 0 insertions, 42 deletions
diff --git a/vendor/github.com/vektah/gqlparser/gqlparser.go b/vendor/github.com/vektah/gqlparser/gqlparser.go deleted file mode 100644 index 71e46407..00000000 --- a/vendor/github.com/vektah/gqlparser/gqlparser.go +++ /dev/null @@ -1,42 +0,0 @@ -package gqlparser - -import ( - "github.com/vektah/gqlparser/ast" - "github.com/vektah/gqlparser/gqlerror" - "github.com/vektah/gqlparser/parser" - "github.com/vektah/gqlparser/validator" - _ "github.com/vektah/gqlparser/validator/rules" -) - -func LoadSchema(str ...*ast.Source) (*ast.Schema, *gqlerror.Error) { - return validator.LoadSchema(append([]*ast.Source{validator.Prelude}, str...)...) -} - -func MustLoadSchema(str ...*ast.Source) *ast.Schema { - s, err := validator.LoadSchema(append([]*ast.Source{validator.Prelude}, str...)...) - if err != nil { - panic(err) - } - return s -} - -func LoadQuery(schema *ast.Schema, str string) (*ast.QueryDocument, gqlerror.List) { - query, err := parser.ParseQuery(&ast.Source{Input: str}) - if err != nil { - return nil, gqlerror.List{err} - } - errs := validator.Validate(schema, query) - if errs != nil { - return nil, errs - } - - return query, nil -} - -func MustLoadQuery(schema *ast.Schema, str string) *ast.QueryDocument { - q, err := LoadQuery(schema, str) - if err != nil { - panic(err) - } - return q -} |