Documentation ¶
Overview ¶
Package ast provides an AST of a GraphQL query or schema.
This package's API is UNSTABLE. New members may be added at any time, or renamed/moved.
Design notes: this package should consist of simple structs, and perhaps some marshaling code. No business logic, should just be storage of a parsed document
Index ¶
- type Argument
- type Arguments
- type ArgumentsDefinition
- type ArrayValue
- type BooleanValue
- type Directive
- type Directives
- type Document
- func (d *Document) AddFragmentDefinition(frag *FragmentDefinition)
- func (d *Document) AddOperationDefinition(op *OperationDefinition)
- func (d *Document) LookupFragmentDefinition(name string) *FragmentDefinition
- func (d *Document) LookupQueryOperation(name string) *OperationDefinition
- func (d *Document) MarshalGraphQL(w io.Writer) error
- type EnumTypeDefinition
- type EnumValue
- type EnumValueDefinition
- type EnumValueDefinitions
- type Field
- type FieldDefinition
- type FieldSelection
- type FieldsDefinition
- type FloatValue
- type FragmentDefinition
- type FragmentSpreadSelection
- type GraphQLMarshaler
- type ImplementsInterfaces
- type InlineFragmentSelection
- type InputObjectTypeDefinition
- type InputObjectValueDefinitions
- type InputValueDefinition
- type IntValue
- type InterfaceTypeDefinition
- type Kind
- type ListType
- type NilValue
- type NotNilType
- type ObjectTypeDefinition
- type ObjectValue
- type OperationDefinition
- type OperationType
- type ReferenceValue
- type ScalarTypeDefinition
- type Selection
- type SelectionSet
- type SimpleType
- type StringValue
- type Type
- type UnionMembership
- type UnionTypeDefinition
- type Value
- type VariableDefinition
- type VariableDefinitions
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Arguments ¶
type Arguments []*Argument
type ArgumentsDefinition ¶
type ArgumentsDefinition []*InputValueDefinition
type ArrayValue ¶
type ArrayValue struct {
V []Value
}
func (ArrayValue) Representation ¶
func (v ArrayValue) Representation() string
type BooleanValue ¶
type BooleanValue struct {
V bool
}
func (BooleanValue) Representation ¶
func (v BooleanValue) Representation() string
type Directives ¶
type Directives []*Directive
func (Directives) ByName ¶
func (v Directives) ByName(name string) (directive *Directive, found bool)
ByName finds the directive with the given name, setting found to indicate if it was found
func (Directives) MarshalGraphQL ¶
func (v Directives) MarshalGraphQL(w io.Writer) error
type Document ¶
type Document struct { OperationDefinitions []*OperationDefinition FragmentDefinitions []*FragmentDefinition // contains filtered or unexported fields }
func (*Document) AddFragmentDefinition ¶
func (d *Document) AddFragmentDefinition(frag *FragmentDefinition)
func (*Document) AddOperationDefinition ¶
func (d *Document) AddOperationDefinition(op *OperationDefinition)
func (*Document) LookupFragmentDefinition ¶
func (d *Document) LookupFragmentDefinition(name string) *FragmentDefinition
func (*Document) LookupQueryOperation ¶
func (d *Document) LookupQueryOperation(name string) *OperationDefinition
type EnumTypeDefinition ¶
type EnumTypeDefinition struct { Description string Name string Directives Directives EnumValueDefinitions EnumValueDefinitions }
type EnumValueDefinition ¶
type EnumValueDefinition struct { Description string Value string Directives Directives }
type EnumValueDefinitions ¶
type EnumValueDefinitions []*EnumValueDefinition
type Field ¶
type Field struct { Alias string Name string Row int Col int Arguments Arguments Directives Directives SelectionSet SelectionSet }
type FieldDefinition ¶
type FieldDefinition struct { Description string Name string ArgumentsDefinition ArgumentsDefinition Type Type Directives Directives }
type FieldSelection ¶
type FieldSelection struct {
Field Field
}
func (*FieldSelection) MarshalGraphQL ¶
func (v *FieldSelection) MarshalGraphQL(w io.Writer) error
type FieldsDefinition ¶
type FieldsDefinition []*FieldDefinition
type FloatValue ¶
type FloatValue struct {
V float64
}
func (FloatValue) Representation ¶
func (v FloatValue) Representation() string
type FragmentDefinition ¶
type FragmentDefinition struct { Name string OnType string Directives Directives SelectionSet SelectionSet }
type FragmentSpreadSelection ¶
type FragmentSpreadSelection struct { FragmentName string Directives Directives }
func (*FragmentSpreadSelection) MarshalGraphQL ¶
func (v *FragmentSpreadSelection) MarshalGraphQL(w io.Writer) error
type GraphQLMarshaler ¶
type ImplementsInterfaces ¶
type ImplementsInterfaces []string
type InlineFragmentSelection ¶
type InlineFragmentSelection struct { OnType string Directives Directives SelectionSet SelectionSet }
func (*InlineFragmentSelection) MarshalGraphQL ¶
func (v *InlineFragmentSelection) MarshalGraphQL(w io.Writer) error
type InputObjectTypeDefinition ¶
type InputObjectTypeDefinition struct { Description string Name string Directives Directives InputObjectValueDefinitions InputObjectValueDefinitions }
type InputObjectValueDefinitions ¶
type InputObjectValueDefinitions []*InputValueDefinition
type InputValueDefinition ¶
type InputValueDefinition struct { Description string Name string Type Type DefaultValue Value Directives Directives }
type InterfaceTypeDefinition ¶
type InterfaceTypeDefinition struct { Description string Name string Directives Directives FieldsDefinition FieldsDefinition }
type NotNilType ¶
type NotNilType struct {
Of Type
}
func (*NotNilType) ContainedType ¶
func (t *NotNilType) ContainedType() Type
func (*NotNilType) Kind ¶
func (t *NotNilType) Kind() Kind
func (*NotNilType) Signature ¶
func (t *NotNilType) Signature() string
type ObjectTypeDefinition ¶
type ObjectTypeDefinition struct { Description string Name string ImplementsInterfaces ImplementsInterfaces Directives Directives FieldsDefinition FieldsDefinition }
type ObjectValue ¶
func (ObjectValue) Representation ¶
func (v ObjectValue) Representation() string
type OperationDefinition ¶
type OperationDefinition struct { OperationType OperationType Name string VariableDefinitions VariableDefinitions Directives Directives SelectionSet SelectionSet }
func (*OperationDefinition) MarshalGraphQL ¶
func (o *OperationDefinition) MarshalGraphQL(w io.Writer) error
type OperationType ¶
type OperationType string
const ( OperationTypeQuery OperationType = "query" OperationTypeMutation OperationType = "mutation" OperationTypeSubscription OperationType = "subscription" )
type ReferenceValue ¶
type ReferenceValue struct {
Name string
}
func (ReferenceValue) Representation ¶
func (v ReferenceValue) Representation() string
type ScalarTypeDefinition ¶
type ScalarTypeDefinition struct { Description string Name string Directives Directives }
type Selection ¶
type Selection interface { GraphQLMarshaler }
type SelectionSet ¶
type SelectionSet []Selection
func (SelectionSet) MarshalGraphQL ¶
func (v SelectionSet) MarshalGraphQL(w io.Writer) error
type SimpleType ¶
type SimpleType struct {
Name string
}
func (*SimpleType) ContainedType ¶
func (t *SimpleType) ContainedType() Type
func (*SimpleType) Kind ¶
func (t *SimpleType) Kind() Kind
func (*SimpleType) Signature ¶
func (t *SimpleType) Signature() string
type StringValue ¶
type StringValue struct {
V string
}
func (StringValue) Representation ¶
func (v StringValue) Representation() string
type UnionMembership ¶
type UnionMembership []string
type UnionTypeDefinition ¶
type UnionTypeDefinition struct { Description string Name string Directives Directives UnionMembership UnionMembership }
type Value ¶
type Value interface { Representation() string // contains filtered or unexported methods }
type VariableDefinition ¶
type VariableDefinition struct { VariableName string Type Type DefaultValue Value Directives Directives }
func (*VariableDefinition) MarshalGraphQL ¶
func (v *VariableDefinition) MarshalGraphQL(w io.Writer) error
type VariableDefinitions ¶
type VariableDefinitions []*VariableDefinition
func (VariableDefinitions) MarshalGraphQL ¶
func (v VariableDefinitions) MarshalGraphQL(w io.Writer) error
Click to show internal directories.
Click to hide internal directories.