Documentation ¶
Index ¶
- Constants
- func FormatterToString(s Formatter) string
- func StringListGet(l []string, name string) *string
- func StringListSelect(l []string, keep func(d string) bool) []string
- type Argument
- type ArgumentList
- func (from ArgumentList) DeepCopy() (to ArgumentList)
- func (l ArgumentList) Get(name string) (Literal, bool)
- func (l ArgumentList) MustGet(name string) Literal
- func (l ArgumentList) ScanValue(vars map[string]interface{}, v interface{}) error
- func (l ArgumentList) Value(vars map[string]interface{}) map[string]interface{}
- func (t ArgumentList) WriteTo(out io.StringWriter)
- type BasicLit
- type Description
- type Directive
- type DirectiveDecl
- type DirectiveList
- func (t DirectiveList) AddIfMissing(to *Schema, from *Schema)
- func (from DirectiveList) DeepCopy() (to DirectiveList)
- func (l DirectiveList) Get(name string) *Directive
- func (l DirectiveList) Select(keep func(d *Directive) bool) DirectiveList
- func (t DirectiveList) Sort()
- func (t DirectiveList) WriteTo(out io.StringWriter)
- type Enum
- type EnumValue
- type EnumValueList
- type Field
- type FieldList
- type FieldSchema
- type FieldSelection
- func (from *FieldSelection) DeepCopy() Selection
- func (t FieldSelection) GetSelections(doc *QueryDocument) SelectionList
- func (t FieldSelection) Location() qerrors.Location
- func (t *FieldSelection) SetSelections(doc *QueryDocument, v SelectionList)
- func (t *FieldSelection) WriteTo(out io.StringWriter)
- type Formatter
- type Fragment
- type FragmentDecl
- type FragmentList
- type FragmentSpread
- func (from *FragmentSpread) DeepCopy() Selection
- func (t FragmentSpread) GetSelections(doc *QueryDocument) SelectionList
- func (t FragmentSpread) Location() qerrors.Location
- func (t *FragmentSpread) SetSelections(doc *QueryDocument, v SelectionList)
- func (t *FragmentSpread) WriteTo(out io.StringWriter)
- type HasDirectives
- type InlineFragment
- func (from *InlineFragment) DeepCopy() Selection
- func (t InlineFragment) GetSelections(doc *QueryDocument) SelectionList
- func (t InlineFragment) Location() qerrors.Location
- func (t *InlineFragment) SetSelections(doc *QueryDocument, v SelectionList)
- func (t *InlineFragment) WriteTo(out io.StringWriter)
- type InputObject
- func (t *InputObject) AddIfMissing(to *Schema, from *Schema)
- func (t *InputObject) Description() string
- func (t *InputObject) GetDirectives() DirectiveList
- func (*InputObject) Kind() string
- func (t *InputObject) Sort()
- func (t *InputObject) String() string
- func (t *InputObject) TypeName() string
- func (t *InputObject) WriteTo(out io.StringWriter)
- type InputValue
- func (t *InputValue) AddIfMissing(to *Schema, from *Schema)
- func (from *InputValue) DeepCopy() *InputValue
- func (t *InputValue) GetDirectives() DirectiveList
- func (t *InputValue) Kind() string
- func (t *InputValue) Sort()
- func (t *InputValue) String() string
- func (t *InputValue) WriteTo(out io.StringWriter)
- type InputValueList
- type Interface
- func (t *Interface) AddIfMissing(to *Schema, from *Schema)
- func (t *Interface) Description() string
- func (t *Interface) GetDirectives() DirectiveList
- func (*Interface) Kind() string
- func (t *Interface) Sort()
- func (t *Interface) String() string
- func (t *Interface) TypeName() string
- func (t *Interface) WriteTo(out io.StringWriter)
- type InterfaceList
- type List
- type ListLit
- type Literal
- type Location
- type NamedType
- type NonNull
- type NullLit
- type Object
- func (t *Object) AddIfMissing(to *Schema, from *Schema)
- func (t *Object) Description() string
- func (t *Object) GetDirectives() DirectiveList
- func (*Object) Kind() string
- func (t *Object) Sort()
- func (t *Object) String() string
- func (t *Object) TypeName() string
- func (t *Object) WriteTo(out io.StringWriter)
- type ObjectLit
- type ObjectLitField
- type Operation
- type OperationList
- type OperationType
- type QueryDocument
- func (d *QueryDocument) Close()
- func (from *QueryDocument) DeepCopy() *QueryDocument
- func (d *QueryDocument) GetOperation(operationName string) (*Operation, error)
- func (doc *QueryDocument) Parse(queryString string) error
- func (doc *QueryDocument) ParseWithDescriptions(queryString string) error
- func (s *QueryDocument) String() string
- func (s *QueryDocument) WriteTo(out io.StringWriter)
- type Resolver
- type Scalar
- type Schema
- func (t *Schema) AddIfMissing(to *Schema, from *Schema)
- func (t *Schema) GetDirectives() DirectiveList
- func (*Schema) Kind() string
- func (s *Schema) Parse(schemaString string) error
- func (s *Schema) RenameTypes(renamer func(string) string)
- func (s *Schema) Resolve(name string) Type
- func (s *Schema) ResolveTypes() error
- func (s *Schema) String() string
- func (s *Schema) VisitDirective(directiveDecl *DirectiveDecl, ...) error
- func (s *Schema) WriteTo(out io.StringWriter)
- type Selection
- type SelectionList
- type Sortable
- type Type
- type TypeName
- type Union
- type Variable
Constants ¶
const ( InvalidOperation OperationType = "" Query = "query" Mutation = "mutation" Subscription = "subscription" )
Variables ¶
This section is empty.
Functions ¶
func FormatterToString ¶
func StringListGet ¶
Types ¶
type ArgumentList ¶
type ArgumentList []Argument
func ParseArguments ¶
func ParseArguments(l *lexer.Lexer) ArgumentList
func (ArgumentList) DeepCopy ¶
func (from ArgumentList) DeepCopy() (to ArgumentList)
func (ArgumentList) MustGet ¶
func (l ArgumentList) MustGet(name string) Literal
func (ArgumentList) ScanValue ¶
func (l ArgumentList) ScanValue(vars map[string]interface{}, v interface{}) error
ScanValue stores the values of the argument list in the value pointed to by v. If v is nil or not a pointer, ScanValue returns an error.
func (ArgumentList) Value ¶
func (l ArgumentList) Value(vars map[string]interface{}) map[string]interface{}
func (ArgumentList) WriteTo ¶
func (t ArgumentList) WriteTo(out io.StringWriter)
type BasicLit ¶
func ConsumeLiteral ¶
func (*BasicLit) WriteTo ¶
func (lit *BasicLit) WriteTo(out io.StringWriter)
type Description ¶
type Description = lexer.Description
func NewDescription ¶
func NewDescription(text string) Description
type Directive ¶
type Directive struct { Name string NameLoc Location Args ArgumentList }
func (*Directive) WriteTo ¶
func (t *Directive) WriteTo(out io.StringWriter)
type DirectiveDecl ¶
type DirectiveDecl struct { Name string Desc Description Locs []string Args InputValueList }
http://facebook.github.io/graphql/draft/#sec-Type-System.Directives
func (*DirectiveDecl) WriteTo ¶
func (t *DirectiveDecl) WriteTo(out io.StringWriter)
type DirectiveList ¶
type DirectiveList []*Directive
func ParseDirectives ¶
func ParseDirectives(l *lexer.Lexer) DirectiveList
func (DirectiveList) AddIfMissing ¶
func (t DirectiveList) AddIfMissing(to *Schema, from *Schema)
func (DirectiveList) DeepCopy ¶
func (from DirectiveList) DeepCopy() (to DirectiveList)
func (DirectiveList) Get ¶
func (l DirectiveList) Get(name string) *Directive
func (DirectiveList) Select ¶
func (l DirectiveList) Select(keep func(d *Directive) bool) DirectiveList
func (DirectiveList) Sort ¶
func (t DirectiveList) Sort()
func (DirectiveList) WriteTo ¶
func (t DirectiveList) WriteTo(out io.StringWriter)
type Enum ¶
type Enum struct { Name string Values EnumValueList // NOTE: the spec refers to this as `EnumValuesDefinition`. Desc Description Directives DirectiveList }
Enum types describe a set of possible values.
Like scalar types, Enum types also represent leaf values in a GraphQL type system.
http://facebook.github.io/graphql/draft/#sec-Enums
func (*Enum) AddIfMissing ¶
func (*Enum) Description ¶
func (*Enum) GetDirectives ¶
func (t *Enum) GetDirectives() DirectiveList
func (*Enum) WriteTo ¶
func (t *Enum) WriteTo(out io.StringWriter)
type EnumValue ¶
type EnumValue struct { Name string Directives DirectiveList Desc Description }
EnumValue types are unique values that may be serialized as a string: the name of the represented value.
http://facebook.github.io/graphql/draft/#EnumValueDefinition
func (*EnumValue) AddIfMissing ¶
func (*EnumValue) GetDirectives ¶
func (t *EnumValue) GetDirectives() DirectiveList
func (*EnumValue) WriteTo ¶
func (t *EnumValue) WriteTo(out io.StringWriter)
type EnumValueList ¶
type EnumValueList []*EnumValue
func (EnumValueList) Sort ¶
func (t EnumValueList) Sort()
type Field ¶
type Field struct { Name string `json:"name"` Args InputValueList `json:"args"` // NOTE: the spec refers to this as `ArgumentsDefinition`. Type Type Directives DirectiveList Desc Description `json:"desc"` Extension interface{} `json:"-"` }
Field is a conceptual function which yields values. http://facebook.github.io/graphql/draft/#FieldDefinition
func (*Field) AddIfMissing ¶
func (*Field) GetDirectives ¶
func (t *Field) GetDirectives() DirectiveList
func (*Field) WriteTo ¶
func (t *Field) WriteTo(out io.StringWriter)
type FieldList ¶
type FieldList []*Field
FieldsList is a list of an Object's Fields.
http://facebook.github.io/graphql/draft/#FieldsDefinition
func (FieldList) AddIfMissing ¶
func (FieldList) Get ¶
Get iterates over the field list, returning a pointer-to-Field when the field name matches the provided `name` argument. Returns nil when no field was found by that name.
type FieldSchema ¶
type FieldSelection ¶
type FieldSelection struct { Alias string AliasLoc Location Name string NameLoc Location Arguments ArgumentList Directives DirectiveList Selections SelectionList SelectionSetLoc qerrors.Location Schema *FieldSchema Extension interface{} }
func (*FieldSelection) DeepCopy ¶
func (from *FieldSelection) DeepCopy() Selection
func (FieldSelection) GetSelections ¶
func (t FieldSelection) GetSelections(doc *QueryDocument) SelectionList
func (FieldSelection) Location ¶
func (t FieldSelection) Location() qerrors.Location
func (*FieldSelection) SetSelections ¶
func (t *FieldSelection) SetSelections(doc *QueryDocument, v SelectionList)
func (*FieldSelection) WriteTo ¶
func (t *FieldSelection) WriteTo(out io.StringWriter)
type Formatter ¶
type Formatter interface {
WriteTo(out io.StringWriter)
}
type Fragment ¶
type Fragment struct { On TypeName Selections SelectionList }
type FragmentDecl ¶
type FragmentDecl struct { Fragment Name string NameLoc Location Directives DirectiveList Loc qerrors.Location }
func (*FragmentDecl) DeepCopy ¶
func (from *FragmentDecl) DeepCopy() *FragmentDecl
func (*FragmentDecl) WriteTo ¶
func (o *FragmentDecl) WriteTo(out io.StringWriter)
type FragmentList ¶
type FragmentList []*FragmentDecl
func (FragmentList) DeepCopy ¶
func (from FragmentList) DeepCopy() (to FragmentList)
func (FragmentList) Get ¶
func (l FragmentList) Get(name string) *FragmentDecl
type FragmentSpread ¶
type FragmentSpread struct { Name string NameLoc Location Directives DirectiveList Loc qerrors.Location }
func (*FragmentSpread) DeepCopy ¶
func (from *FragmentSpread) DeepCopy() Selection
func (FragmentSpread) GetSelections ¶
func (t FragmentSpread) GetSelections(doc *QueryDocument) SelectionList
func (FragmentSpread) Location ¶
func (t FragmentSpread) Location() qerrors.Location
func (*FragmentSpread) SetSelections ¶
func (t *FragmentSpread) SetSelections(doc *QueryDocument, v SelectionList)
func (*FragmentSpread) WriteTo ¶
func (t *FragmentSpread) WriteTo(out io.StringWriter)
type HasDirectives ¶
type HasDirectives interface { Type GetDirectives() DirectiveList }
type InlineFragment ¶
type InlineFragment struct { Fragment Directives DirectiveList Loc qerrors.Location }
func (*InlineFragment) DeepCopy ¶
func (from *InlineFragment) DeepCopy() Selection
func (InlineFragment) GetSelections ¶
func (t InlineFragment) GetSelections(doc *QueryDocument) SelectionList
func (InlineFragment) Location ¶
func (t InlineFragment) Location() qerrors.Location
func (*InlineFragment) SetSelections ¶
func (t *InlineFragment) SetSelections(doc *QueryDocument, v SelectionList)
func (*InlineFragment) WriteTo ¶
func (t *InlineFragment) WriteTo(out io.StringWriter)
type InputObject ¶
type InputObject struct { Name string Desc Description Fields InputValueList Directives DirectiveList }
InputObject types define a set of input fields; the input fields are either scalars, enums, or other input objects.
This allows arguments to accept arbitrarily complex structs.
http://facebook.github.io/graphql/draft/#sec-Input-Objects
func (*InputObject) AddIfMissing ¶
func (t *InputObject) AddIfMissing(to *Schema, from *Schema)
func (*InputObject) Description ¶
func (t *InputObject) Description() string
func (*InputObject) GetDirectives ¶
func (t *InputObject) GetDirectives() DirectiveList
func (*InputObject) Kind ¶
func (*InputObject) Kind() string
func (*InputObject) Sort ¶
func (t *InputObject) Sort()
func (*InputObject) String ¶
func (t *InputObject) String() string
func (*InputObject) TypeName ¶
func (t *InputObject) TypeName() string
func (*InputObject) WriteTo ¶
func (t *InputObject) WriteTo(out io.StringWriter)
type InputValue ¶
type InputValue struct { Loc qerrors.Location Name string NameLoc Location Type Type TypeLoc qerrors.Location Default Literal Desc Description Directives DirectiveList }
http://facebook.github.io/graphql/draft/#InputValueDefinition
func ParseInputValue ¶
func ParseInputValue(l *lexer.Lexer) *InputValue
func (*InputValue) AddIfMissing ¶
func (t *InputValue) AddIfMissing(to *Schema, from *Schema)
func (*InputValue) DeepCopy ¶
func (from *InputValue) DeepCopy() *InputValue
func (*InputValue) GetDirectives ¶
func (t *InputValue) GetDirectives() DirectiveList
func (*InputValue) Kind ¶
func (t *InputValue) Kind() string
func (*InputValue) Sort ¶
func (t *InputValue) Sort()
func (*InputValue) String ¶
func (t *InputValue) String() string
func (*InputValue) WriteTo ¶
func (t *InputValue) WriteTo(out io.StringWriter)
type InputValueList ¶
type InputValueList []*InputValue
func (InputValueList) AddIfMissing ¶
func (t InputValueList) AddIfMissing(to *Schema, from *Schema)
func (InputValueList) DeepCopy ¶
func (from InputValueList) DeepCopy() (to InputValueList)
func (InputValueList) Get ¶
func (l InputValueList) Get(name string) *InputValue
func (InputValueList) Sort ¶
func (t InputValueList) Sort()
func (InputValueList) WriteTo ¶
func (t InputValueList) WriteTo(out io.StringWriter)
type Interface ¶
type Interface struct { Name string PossibleTypes []*Object Fields FieldList // NOTE: the spec refers to this as `FieldsDefinition`. Desc Description Directives DirectiveList }
Interface types represent a list of named fields and their arguments.
GraphQL objects can then implement these interfaces which requires that the object type will define all fields defined by those interfaces.
http://facebook.github.io/graphql/draft/#sec-Interfaces
func (*Interface) AddIfMissing ¶
func (*Interface) Description ¶
func (*Interface) GetDirectives ¶
func (t *Interface) GetDirectives() DirectiveList
func (*Interface) WriteTo ¶
func (t *Interface) WriteTo(out io.StringWriter)
type InterfaceList ¶
type InterfaceList []*Interface
func (InterfaceList) Get ¶
func (l InterfaceList) Get(name string) *Interface
func (InterfaceList) Select ¶
func (l InterfaceList) Select(keep func(d *Interface) bool) InterfaceList
type List ¶
type List struct {
OfType Type
}
func (*List) AddIfMissing ¶
func (*List) WriteTo ¶
func (t *List) WriteTo(out io.StringWriter)
type Literal ¶
type Literal interface { Evaluate(vars map[string]interface{}) interface{} String() string Location() qerrors.Location WriteTo(out io.StringWriter) }
func DeepCopyLiteral ¶
type NonNull ¶
type NonNull struct {
OfType Type
}
func (*NonNull) AddIfMissing ¶
func (*NonNull) WriteTo ¶
func (t *NonNull) WriteTo(out io.StringWriter)
type Object ¶
type Object struct { Name string Interfaces InterfaceList Fields FieldList `json:"fields"` Desc Description Directives DirectiveList InterfaceNames []string }
Object types represent a list of named fields, each of which yield a value of a specific type.
GraphQL queries are hierarchical and composed, describing a tree of information. While Scalar types describe the leaf values of these hierarchical types, Objects describe the intermediate levels.
http://facebook.github.io/graphql/draft/#sec-Objects
func (*Object) AddIfMissing ¶
func (*Object) Description ¶
func (*Object) GetDirectives ¶
func (t *Object) GetDirectives() DirectiveList
func (*Object) WriteTo ¶
func (t *Object) WriteTo(out io.StringWriter)
type ObjectLit ¶
type ObjectLit struct { Fields []*ObjectLitField Loc qerrors.Location }
func (*ObjectLit) WriteTo ¶
func (t *ObjectLit) WriteTo(out io.StringWriter)
type ObjectLitField ¶
func (*ObjectLitField) DeepCopy ¶
func (from *ObjectLitField) DeepCopy() *ObjectLitField
type Operation ¶
type Operation struct { Type OperationType Name string NameLoc Location Vars InputValueList Selections SelectionList Directives DirectiveList Loc qerrors.Location }
func (Operation) GetSelections ¶
func (t Operation) GetSelections(doc *QueryDocument) SelectionList
func (*Operation) SetSelections ¶
func (t *Operation) SetSelections(doc *QueryDocument, v SelectionList)
func (*Operation) WriteTo ¶
func (o *Operation) WriteTo(out io.StringWriter)
type OperationList ¶
type OperationList []*Operation
func (OperationList) DeepCopy ¶
func (from OperationList) DeepCopy() (to OperationList)
func (OperationList) Get ¶
func (l OperationList) Get(name string) *Operation
type OperationType ¶
type OperationType string
func GetOperationType ¶
func GetOperationType(v string) OperationType
type QueryDocument ¶
type QueryDocument struct { Operations OperationList Fragments FragmentList }
func (*QueryDocument) Close ¶
func (d *QueryDocument) Close()
func (*QueryDocument) DeepCopy ¶
func (from *QueryDocument) DeepCopy() *QueryDocument
func (*QueryDocument) GetOperation ¶
func (d *QueryDocument) GetOperation(operationName string) (*Operation, error)
func (*QueryDocument) Parse ¶
func (doc *QueryDocument) Parse(queryString string) error
func (*QueryDocument) ParseWithDescriptions ¶
func (doc *QueryDocument) ParseWithDescriptions(queryString string) error
func (*QueryDocument) String ¶
func (s *QueryDocument) String() string
func (*QueryDocument) WriteTo ¶
func (s *QueryDocument) WriteTo(out io.StringWriter)
type Scalar ¶
type Scalar struct { Name string Desc Description Directives DirectiveList }
Scalar types represent primitive leaf values (e.g. a string or an integer) in a GraphQL type system.
GraphQL responses take the form of a hierarchical tree; the leaves on these trees are GraphQL scalars.
http://facebook.github.io/graphql/draft/#sec-Scalars
func (*Scalar) AddIfMissing ¶
func (*Scalar) Description ¶
func (*Scalar) GetDirectives ¶
func (t *Scalar) GetDirectives() DirectiveList
func (*Scalar) WriteTo ¶
func (t *Scalar) WriteTo(out io.StringWriter)
type Schema ¶
type Schema struct { // These are directives applied to the schema. Directives DirectiveList // EntryPoints determines the place in the type system where `query`, `mutation`, and // `subscription` operations begin. // // http://facebook.github.io/graphql/draft/#sec-Root-Operation-Types // // NOTE: The specification refers to this concept as "Root Operation Types". // TODO: Rename the `EntryPoints` field to `RootOperationTypes` to align with spec terminology. EntryPoints map[OperationType]NamedType // Types are the fundamental unit of any GraphQL schema. // There are six kinds of named types, and two wrapping types. // // http://facebook.github.io/graphql/draft/#sec-Types Types map[string]NamedType // Directives are used to annotate various parts of a GraphQL document as an indicator that they // should be evaluated differently by a validator, executor, or client tool such as a code // generator. // // http://facebook.github.io/graphql/draft/#sec-Type-System.Directives DeclaredDirectives map[string]*DirectiveDecl EntryPointNames map[OperationType]string }
Schema represents a GraphQL service's collective type system capabilities. A schema is defined in terms of the types and directives it supports as well as the root operation types for each kind of operation: `query`, `mutation`, and `subscription`.
For a more formal definition, read the relevant section in the specification:
http://facebook.github.io/graphql/draft/#sec-Schema
var Meta *Schema
func (*Schema) AddIfMissing ¶
func (*Schema) GetDirectives ¶
func (t *Schema) GetDirectives() DirectiveList
func (*Schema) RenameTypes ¶
func (*Schema) ResolveTypes ¶
func (*Schema) VisitDirective ¶
func (s *Schema) VisitDirective(directiveDecl *DirectiveDecl, visitor func(directive *Directive, parents ...HasDirectives) error) error
*
func (*Schema) WriteTo ¶
func (s *Schema) WriteTo(out io.StringWriter)
type Selection ¶
type Selection interface { Formatter GetSelections(doc *QueryDocument) SelectionList SetSelections(doc *QueryDocument, v SelectionList) Location() qerrors.Location }
func DeepCopySelection ¶
type SelectionList ¶
type SelectionList []Selection
func (SelectionList) DeepCopy ¶
func (from SelectionList) DeepCopy() (to SelectionList)
func (SelectionList) WriteTo ¶
func (o SelectionList) WriteTo(out io.StringWriter)
type Type ¶
type Type interface { Kind() string String() string AddIfMissing(to *Schema, from *Schema) Formatter }
func DeepestType ¶
type TypeName ¶
func (*TypeName) AddIfMissing ¶
func (*TypeName) WriteTo ¶
func (t *TypeName) WriteTo(out io.StringWriter)
type Union ¶
type Union struct { Name string PossibleTypes []*Object // NOTE: the spec refers to this as `UnionMemberTypes`. Desc Description TypeNames []string Directives DirectiveList }
Union types represent objects that could be one of a list of GraphQL object types, but provides no guaranteed fields between those types.
They also differ from interfaces in that object types declare what interfaces they implement, but are not aware of what unions contain them.
http://facebook.github.io/graphql/draft/#sec-Unions
func (*Union) AddIfMissing ¶
func (*Union) Description ¶
func (*Union) GetDirectives ¶
func (t *Union) GetDirectives() DirectiveList
func (*Union) WriteTo ¶
func (t *Union) WriteTo(out io.StringWriter)