Documentation
¶
Index ¶
- Variables
- func AddRule(name string, ruleFunc RuleFunc)
- func IsValidFloatString(val reflect.Value, kind reflect.Kind) bool
- func IsValidIntString(val reflect.Value, kind reflect.Kind) bool
- func LoadSchema(inputs ...*Source) (*Schema, error)
- func RemoveRule(name string)
- func ReplaceRule(name string, ruleFunc RuleFunc)
- func Validate(schema *Schema, doc *QueryDocument, rules ...Rule) gqlerror.Listdeprecated
- func ValidateSchemaDocument(sd *SchemaDocument) (*Schema, error)
- func ValidateWithRules(schema *Schema, doc *QueryDocument, rules *validatorrules.Rules) gqlerror.List
- func ValidateWithRulesWithSources(schema *Schema, doc *QueryDocument, rules *validatorrules.Rules) gqlerror.SourceList
- func ValidateWithSources(schema *Schema, doc *QueryDocument, rules ...Rule) gqlerror.SourceList
- func VariableValues(schema *ast.Schema, op *ast.OperationDefinition, variables map[string]any) (map[string]any, error)
- func Walk(schema *Schema, document *QueryDocument, observers *Events)
- type AddErrFunc
- type ErrorOption
- type Events
- type Rule
- type RuleFunc
- type Walker
Constants ¶
This section is empty.
Variables ¶
var ( Message = core.Message QuotedOrList = core.QuotedOrList OrList = core.OrList )
var ErrUnexpectedType = errors.New("Unexpected Type")
var Prelude = &ast.Source{ Name: "prelude.graphql", Input: preludeGraphql, BuiltIn: true, }
Functions ¶
func AddRule ¶
AddRule adds a rule to the rule set. ruleFunc is called once each time `Validate` is executed.
func IsValidFloatString ¶ added in v2.4.2
func IsValidIntString ¶ added in v2.4.2
func LoadSchema ¶
func LoadSchema(inputs ...*Source) (*Schema, error)
func RemoveRule ¶ added in v2.5.18
func RemoveRule(name string)
RemoveRule removes an existing rule from the rule set if one of the same name exists. The rule set is global, so it is not safe for concurrent changes.
func ReplaceRule ¶ added in v2.5.21
ReplaceRule replaces an existing rule from the rule set if one of the same name exists. If no match is found, it will add a new rule to the rule set. The rule set is global, so it is not safe for concurrent changes.
func ValidateSchemaDocument ¶
func ValidateSchemaDocument(sd *SchemaDocument) (*Schema, error)
func ValidateWithRules ¶ added in v2.5.29
func ValidateWithRules( schema *Schema, doc *QueryDocument, rules *validatorrules.Rules, ) gqlerror.List
func ValidateWithRulesWithSources ¶ added in v2.5.37
func ValidateWithRulesWithSources( schema *Schema, doc *QueryDocument, rules *validatorrules.Rules, ) gqlerror.SourceList
ValidateWithRulesWithSources is the source-aware counterpart to ValidateWithRules.
func ValidateWithSources ¶ added in v2.5.37
func ValidateWithSources(schema *Schema, doc *QueryDocument, rules ...Rule) gqlerror.SourceList
ValidateWithSources is the source-aware counterpart to Validate. It keeps source documents for every location recorded by the built-in At option while leaving Error and the regular validation API unchanged.
Types ¶
type AddErrFunc ¶
type AddErrFunc = core.AddErrFunc
type ErrorOption ¶
type ErrorOption = core.ErrorOption