MCPcopy Create free account
hub / github.com/vektah/gqlparser / LoadQueryWithRules

Function LoadQueryWithRules

gqlparser.go:53–73  ·  view source on GitHub ↗
(
	schema *ast.Schema,
	str string,
	rules *rules.Rules,
)

Source from the content-addressed store, hash-verified

51}
52
53func LoadQueryWithRules(
54 schema *ast.Schema,
55 str string,
56 rules *rules.Rules,
57) (*ast.QueryDocument, gqlerror.List) {
58 query, err := parser.ParseQuery(&ast.Source{Input: str})
59 if err != nil {
60 gqlErr := &gqlerror.Error{}
61 ok := errors.As(err, &gqlErr)
62 if ok {
63 return nil, gqlerror.List{gqlErr}
64 }
65 return nil, gqlerror.List{gqlerror.Wrap(err)}
66 }
67 errs := validator.ValidateWithRules(schema, query, rules)
68 if len(errs) > 0 {
69 return nil, errs
70 }
71
72 return query, nil
73}
74
75// Deprecated: use MustLoadQueryWithRules instead.
76func MustLoadQuery(schema *ast.Schema, str string) *ast.QueryDocument {

Callers 1

MustLoadQueryWithRulesFunction · 0.85

Calls 4

ParseQueryFunction · 0.92
WrapFunction · 0.92
ValidateWithRulesFunction · 0.92
AsMethod · 0.80

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…