( schema *ast.Schema, str string, rules *rules.Rules, )
| 51 | } |
| 52 | |
| 53 | func 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. |
| 76 | func MustLoadQuery(schema *ast.Schema, str string) *ast.QueryDocument { |
no test coverage detected
searching dependent graphs…