Documentation ¶
Index ¶
- Variables
- func AddRule(name string, f ruleFunc)
- func LoadSchema(inputs ...*Source) (*Schema, *gqlerror.Error)
- func OrList(items ...string) string
- func QuotedOrList(items ...string) string
- func SuggestionList(input string, options []string) []string
- func Validate(schema *Schema, doc *QueryDocument) gqlerror.List
- func ValidateSchemaDocument(ast *SchemaDocument) (*Schema, *gqlerror.Error)
- func VariableValues(schema *ast.Schema, op *ast.OperationDefinition, ...) (map[string]interface{}, *gqlerror.Error)
- func Walk(schema *ast.Schema, document *ast.QueryDocument, observers *Events)
- type AddErrFunc
- type ErrorOption
- func At(position *ast.Position) ErrorOption
- func Message(msg string, args ...interface{}) ErrorOption
- func SuggestListQuoted(prefix string, typed string, suggestions []string) ErrorOption
- func SuggestListUnquoted(prefix string, typed string, suggestions []string) ErrorOption
- func Suggestf(suggestion string, args ...interface{}) ErrorOption
- type Events
- func (o *Events) OnDirective(f func(walker *Walker, directive *ast.Directive))
- func (o *Events) OnDirectiveList(f func(walker *Walker, directives []*ast.Directive))
- func (o *Events) OnField(f func(walker *Walker, field *ast.Field))
- func (o *Events) OnFragment(f func(walker *Walker, fragment *ast.FragmentDefinition))
- func (o *Events) OnFragmentSpread(f func(walker *Walker, fragmentSpread *ast.FragmentSpread))
- func (o *Events) OnInlineFragment(f func(walker *Walker, inlineFragment *ast.InlineFragment))
- func (o *Events) OnOperation(f func(walker *Walker, operation *ast.OperationDefinition))
- func (o *Events) OnValue(f func(walker *Walker, value *ast.Value))
- type Walker
Constants ¶
This section is empty.
Variables ¶
View Source
var Prelude = &ast.Source{ Name: "prelude.graphql", Input: "# This file defines all the implicitly declared types that are required by the graphql spec. It is implicitly included by calls to LoadSchema\n\n# The `Int` scalar type represents non-fractional signed whole numeric values. Int can represent values between -(2^31) and 2^31 - 1.\nscalar Int\n\n# The `Float` scalar type represents signed double-precision fractional values as specified by [IEEE 754](http://en.wikipedia.org/wiki/IEEE_floating_point).\nscalar Float\n\n# The `String`scalar type represents textual data, represented as UTF-8 character sequences. The String type is most often used by GraphQL to represent free-form human-readable text.\nscalar String\n\n# The `Boolean` scalar type represents ` + \"`\" + `true` + \"`\" + ` or ` + \"`\" + `false` + \"`\" + `.\nscalar Boolean\n\n# The `ID` scalar type represents a unique identifier, often used to refetch an object or as key for a cache. The ID type appears in a JSON response as a String; however, it is not intended to be human-readable. When expected as an input type, any string (such as \"4\") or integer (such as 4) input value will be accepted as an ID.\nscalar ID\n\n# The @include directive may be provided for fields, fragment spreads, and inline fragments, and allows for conditional inclusion during execution as described by the if argument.\ndirective @include(if: Boolean!) on FIELD | FRAGMENT_SPREAD | INLINE_FRAGMENT\n\n# The @skip directive may be provided for fields, fragment spreads, and inline fragments, and allows for conditional exclusion during execution as described by the if argument.\ndirective @skip(if: Boolean!) on FIELD | FRAGMENT_SPREAD | INLINE_FRAGMENT\n\n# The @deprecated directive is used within the type system definition language to indicate deprecated portions of a GraphQL service’s schema, such as deprecated fields on a type or deprecated enum values.\ndirective @deprecated(reason: String = \"No longer supported\") on FIELD_DEFINITION | ENUM_VALUE\n\ntype __Schema {\n types: [__Type!]!\n queryType: __Type!\n mutationType: __Type\n subscriptionType: __Type\n directives: [__Directive!]!\n}\n\ntype __Type {\n kind: __TypeKind!\n name: String\n description: String\n\n # OBJECT and INTERFACE only\n fields(includeDeprecated: Boolean = false): [__Field!]\n\n # OBJECT only\n interfaces: [__Type!]\n\n # INTERFACE and UNION only\n possibleTypes: [__Type!]\n\n # ENUM only\n enumValues(includeDeprecated: Boolean = false): [__EnumValue!]\n\n # INPUT_OBJECT only\n inputFields: [__InputValue!]\n\n # NON_NULL and LIST only\n ofType: __Type\n}\n\ntype __Field {\n name: String!\n description: String\n args: [__InputValue!]!\n type: __Type!\n isDeprecated: Boolean!\n deprecationReason: String\n}\n\ntype __InputValue {\n name: String!\n description: String\n type: __Type!\n defaultValue: String\n}\n\ntype __EnumValue {\n name: String!\n description: String\n isDeprecated: Boolean!\n deprecationReason: String\n}\n\nenum __TypeKind {\n SCALAR\n OBJECT\n INTERFACE\n UNION\n ENUM\n INPUT_OBJECT\n LIST\n NON_NULL\n}\n\ntype __Directive {\n name: String!\n description: String\n locations: [__DirectiveLocation!]!\n args: [__InputValue!]!\n}\n\nenum __DirectiveLocation {\n QUERY\n MUTATION\n SUBSCRIPTION\n FIELD\n FRAGMENT_DEFINITION\n FRAGMENT_SPREAD\n INLINE_FRAGMENT\n SCHEMA\n SCALAR\n OBJECT\n FIELD_DEFINITION\n ARGUMENT_DEFINITION\n INTERFACE\n UNION\n ENUM\n ENUM_VALUE\n INPUT_OBJECT\n INPUT_FIELD_DEFINITION\n}\n", BuiltIn: true, }
View Source
var UnexpectedType = fmt.Errorf("Unexpected Type")
Functions ¶
func AddRule ¶
func AddRule(name string, f ruleFunc)
addRule to rule set. f is called once each time `Validate` is executed.
func LoadSchema ¶
func QuotedOrList ¶
Given [ A, B, C ] return '"A", "B", or "C"'.
func SuggestionList ¶
Given an invalid input string and a list of valid options, returns a filtered list of valid options sorted based on their similarity with the input.
func ValidateSchemaDocument ¶
func VariableValues ¶
func VariableValues(schema *ast.Schema, op *ast.OperationDefinition, variables map[string]interface{}) (map[string]interface{}, *gqlerror.Error)
VariableValues coerces and validates variable values
Types ¶
type AddErrFunc ¶
type AddErrFunc func(options ...ErrorOption)
type ErrorOption ¶
func At ¶
func At(position *ast.Position) ErrorOption
func Message ¶
func Message(msg string, args ...interface{}) ErrorOption
func SuggestListQuoted ¶
func SuggestListQuoted(prefix string, typed string, suggestions []string) ErrorOption
func SuggestListUnquoted ¶
func SuggestListUnquoted(prefix string, typed string, suggestions []string) ErrorOption
func Suggestf ¶
func Suggestf(suggestion string, args ...interface{}) ErrorOption
type Events ¶
type Events struct {
// contains filtered or unexported fields
}
func (*Events) OnDirective ¶
func (*Events) OnDirectiveList ¶
func (*Events) OnFragment ¶
func (o *Events) OnFragment(f func(walker *Walker, fragment *ast.FragmentDefinition))
func (*Events) OnFragmentSpread ¶
func (o *Events) OnFragmentSpread(f func(walker *Walker, fragmentSpread *ast.FragmentSpread))
func (*Events) OnInlineFragment ¶
func (o *Events) OnInlineFragment(f func(walker *Walker, inlineFragment *ast.InlineFragment))
func (*Events) OnOperation ¶
func (o *Events) OnOperation(f func(walker *Walker, operation *ast.OperationDefinition))
Source Files ¶
Click to show internal directories.
Click to hide internal directories.