Documentation ¶
Index ¶
- func Dump(i interface{}) string
- type Argument
- type ArgumentDefinition
- type ArgumentDefinitionList
- type ArgumentList
- type ChildValue
- type ChildValueList
- type Definition
- type DefinitionKind
- type DefinitionList
- type Directive
- type DirectiveDefinition
- type DirectiveDefinitionList
- type DirectiveList
- type DirectiveLocation
- type Dumpable
- type EnumValueDefinition
- type EnumValueList
- type Field
- type FieldDefinition
- type FieldList
- type FragmentDefinition
- type FragmentDefinitionList
- type FragmentSpread
- type InlineFragment
- type Operation
- type OperationDefinition
- type OperationList
- type OperationTypeDefinition
- type OperationTypeDefinitionList
- type Path
- type PathElement
- type PathIndex
- type PathName
- type Position
- type QueryDocument
- type Schema
- type SchemaDefinition
- type SchemaDefinitionList
- type SchemaDocument
- type Selection
- type SelectionSet
- type Source
- type Type
- type Value
- type ValueKind
- type VariableDefinition
- type VariableDefinitionList
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type ArgumentDefinition ¶
type ArgumentDefinitionList ¶
type ArgumentDefinitionList []*ArgumentDefinition
func (ArgumentDefinitionList) ForName ¶
func (l ArgumentDefinitionList) ForName(name string) *ArgumentDefinition
type ArgumentList ¶
type ArgumentList []*Argument
func (ArgumentList) ForName ¶
func (l ArgumentList) ForName(name string) *Argument
type ChildValue ¶
type ChildValueList ¶
type ChildValueList []*ChildValue
func (ChildValueList) ForName ¶
func (v ChildValueList) ForName(name string) *Value
type Definition ¶
type Definition struct { Kind DefinitionKind Description string Name string Directives DirectiveList Interfaces []string // object and input object Fields FieldList // object and input object Types []string // union EnumValues EnumValueList // enum Position *Position `dump:"-"` BuiltIn bool `dump:"-"` }
Definition is the core type definition object, it includes all of the definable types but does *not* cover schema or directives.
@vektah: Javascript implementation has different types for all of these, but they are more similar than different and don't define any behaviour. I think this style of "some hot" struct works better, at least for go.
Type extensions are also represented by this same struct.
func (*Definition) IsAbstractType ¶
func (d *Definition) IsAbstractType() bool
func (*Definition) IsCompositeType ¶
func (d *Definition) IsCompositeType() bool
func (*Definition) IsInputType ¶
func (d *Definition) IsInputType() bool
func (*Definition) IsLeafType ¶
func (d *Definition) IsLeafType() bool
func (*Definition) OneOf ¶
func (d *Definition) OneOf(types ...string) bool
type DefinitionKind ¶
type DefinitionKind string
const ( Scalar DefinitionKind = "SCALAR" Object DefinitionKind = "OBJECT" Interface DefinitionKind = "INTERFACE" Union DefinitionKind = "UNION" Enum DefinitionKind = "ENUM" InputObject DefinitionKind = "INPUT_OBJECT" )
type DefinitionList ¶
type DefinitionList []*Definition
func (DefinitionList) ForName ¶
func (l DefinitionList) ForName(name string) *Definition
type Directive ¶
type Directive struct { Name string Arguments ArgumentList Position *Position `dump:"-"` // Requires validation ParentDefinition *Definition Definition *DirectiveDefinition Location DirectiveLocation }
func (*Directive) ArgumentMap ¶
type DirectiveDefinition ¶
type DirectiveDefinition struct { Description string Name string Arguments ArgumentDefinitionList Locations []DirectiveLocation IsRepeatable bool Position *Position `dump:"-"` }
type DirectiveDefinitionList ¶
type DirectiveDefinitionList []*DirectiveDefinition
func (DirectiveDefinitionList) ForName ¶
func (l DirectiveDefinitionList) ForName(name string) *DirectiveDefinition
type DirectiveList ¶
type DirectiveList []*Directive
func (DirectiveList) ForName ¶
func (l DirectiveList) ForName(name string) *Directive
func (DirectiveList) ForNames ¶
func (l DirectiveList) ForNames(name string) []*Directive
type DirectiveLocation ¶
type DirectiveLocation string
const ( // Executable LocationQuery DirectiveLocation = `QUERY` LocationMutation DirectiveLocation = `MUTATION` LocationSubscription DirectiveLocation = `SUBSCRIPTION` LocationField DirectiveLocation = `FIELD` LocationFragmentDefinition DirectiveLocation = `FRAGMENT_DEFINITION` LocationFragmentSpread DirectiveLocation = `FRAGMENT_SPREAD` LocationInlineFragment DirectiveLocation = `INLINE_FRAGMENT` // Type System LocationSchema DirectiveLocation = `SCHEMA` LocationScalar DirectiveLocation = `SCALAR` LocationObject DirectiveLocation = `OBJECT` LocationFieldDefinition DirectiveLocation = `FIELD_DEFINITION` LocationArgumentDefinition DirectiveLocation = `ARGUMENT_DEFINITION` LocationInterface DirectiveLocation = `INTERFACE` LocationUnion DirectiveLocation = `UNION` LocationEnum DirectiveLocation = `ENUM` LocationEnumValue DirectiveLocation = `ENUM_VALUE` LocationInputObject DirectiveLocation = `INPUT_OBJECT` LocationInputFieldDefinition DirectiveLocation = `INPUT_FIELD_DEFINITION` LocationVariableDefinition DirectiveLocation = `VARIABLE_DEFINITION` )
type EnumValueDefinition ¶
type EnumValueDefinition struct { Description string Name string Directives DirectiveList Position *Position `dump:"-"` }
type EnumValueList ¶
type EnumValueList []*EnumValueDefinition
func (EnumValueList) ForName ¶
func (l EnumValueList) ForName(name string) *EnumValueDefinition
type Field ¶
type Field struct { Alias string Name string Arguments ArgumentList Directives DirectiveList SelectionSet SelectionSet Position *Position `dump:"-"` // Require validation Definition *FieldDefinition ObjectDefinition *Definition }
func (*Field) ArgumentMap ¶
func (*Field) GetPosition ¶
func (*Field) UnmarshalJSON ¶
type FieldDefinition ¶
type FieldDefinition struct { Description string Name string Arguments ArgumentDefinitionList // only for objects DefaultValue *Value // only for input objects Type *Type Directives DirectiveList Position *Position `dump:"-"` }
type FieldList ¶
type FieldList []*FieldDefinition
func (FieldList) ForName ¶
func (l FieldList) ForName(name string) *FieldDefinition
type FragmentDefinition ¶
type FragmentDefinition struct { Name string // Note: fragment variable definitions are experimental and may be changed // or removed in the future. VariableDefinition VariableDefinitionList TypeCondition string Directives DirectiveList SelectionSet SelectionSet // Require validation Definition *Definition Position *Position `dump:"-"` }
func (*FragmentDefinition) UnmarshalJSON ¶
func (f *FragmentDefinition) UnmarshalJSON(b []byte) error
type FragmentDefinitionList ¶
type FragmentDefinitionList []*FragmentDefinition
func (FragmentDefinitionList) ForName ¶
func (l FragmentDefinitionList) ForName(name string) *FragmentDefinition
type FragmentSpread ¶
type FragmentSpread struct { Name string Directives DirectiveList // Require validation ObjectDefinition *Definition Definition *FragmentDefinition Position *Position `dump:"-"` }
func (*FragmentSpread) GetPosition ¶
func (s *FragmentSpread) GetPosition() *Position
type InlineFragment ¶
type InlineFragment struct { TypeCondition string Directives DirectiveList SelectionSet SelectionSet // Require validation ObjectDefinition *Definition Position *Position `dump:"-"` }
func (*InlineFragment) GetPosition ¶
func (s *InlineFragment) GetPosition() *Position
func (*InlineFragment) UnmarshalJSON ¶
func (f *InlineFragment) UnmarshalJSON(b []byte) error
type OperationDefinition ¶
type OperationDefinition struct { Operation Operation Name string VariableDefinitions VariableDefinitionList Directives DirectiveList SelectionSet SelectionSet Position *Position `dump:"-"` }
func (*OperationDefinition) UnmarshalJSON ¶
func (f *OperationDefinition) UnmarshalJSON(b []byte) error
type OperationList ¶
type OperationList []*OperationDefinition
func (OperationList) ForName ¶
func (l OperationList) ForName(name string) *OperationDefinition
type OperationTypeDefinition ¶
type OperationTypeDefinitionList ¶
type OperationTypeDefinitionList []*OperationTypeDefinition
func (OperationTypeDefinitionList) ForType ¶
func (l OperationTypeDefinitionList) ForType(name string) *OperationTypeDefinition
type PathElement ¶
type PathElement interface {
// contains filtered or unexported methods
}
type Position ¶
type Position struct { Start int // The starting position, in runes, of this token in the input. End int // The end position, in runes, of this token in the input. Line int // The line number at the start of this item. Column int // The column number at the start of this item. Src *Source // The source document this token belongs to }
type QueryDocument ¶
type QueryDocument struct { Operations OperationList Fragments FragmentDefinitionList Position *Position `dump:"-"` }
type Schema ¶
type Schema struct { Query *Definition Mutation *Definition Subscription *Definition Types map[string]*Definition Directives map[string]*DirectiveDefinition PossibleTypes map[string][]*Definition Implements map[string][]*Definition Description string }
func (*Schema) AddImplements ¶
func (s *Schema) AddImplements(name string, iface *Definition)
func (*Schema) AddPossibleType ¶
func (s *Schema) AddPossibleType(name string, def *Definition)
func (*Schema) AddTypes ¶
func (s *Schema) AddTypes(defs ...*Definition)
AddTypes is the helper to add types definition to the schema
func (*Schema) GetImplements ¶
func (s *Schema) GetImplements(def *Definition) []*Definition
GetImplements returns all the interface and union definitions that the given definition satisfies
func (*Schema) GetPossibleTypes ¶
func (s *Schema) GetPossibleTypes(def *Definition) []*Definition
GetPossibleTypes will enumerate all the definitions for a given interface or union
type SchemaDefinition ¶
type SchemaDefinition struct { Description string Directives DirectiveList OperationTypes OperationTypeDefinitionList Position *Position `dump:"-"` }
type SchemaDefinitionList ¶
type SchemaDefinitionList []*SchemaDefinition
type SchemaDocument ¶
type SchemaDocument struct { Schema SchemaDefinitionList SchemaExtension SchemaDefinitionList Directives DirectiveDefinitionList Definitions DefinitionList Extensions DefinitionList Position *Position `dump:"-"` }
func (*SchemaDocument) Merge ¶
func (d *SchemaDocument) Merge(other *SchemaDocument)
type Selection ¶
type Selection interface { GetPosition() *Position // contains filtered or unexported methods }
type SelectionSet ¶
type SelectionSet []Selection
func UnmarshalSelectionSet ¶
func UnmarshalSelectionSet(b []byte) (SelectionSet, error)
type Source ¶
type Source struct { // Name is the filename of the source Name string // Input is the actual contents of the source file Input string // BuiltIn indicate whether the source is a part of the specification BuiltIn bool }
Source covers a single *.graphql file
type Value ¶
type Value struct { Raw string Children ChildValueList Kind ValueKind Position *Position `dump:"-"` // Require validation Definition *Definition VariableDefinition *VariableDefinition ExpectedType *Type }
type VariableDefinition ¶
type VariableDefinition struct { Variable string Type *Type DefaultValue *Value Directives DirectiveList Position *Position `dump:"-"` // Requires validation Definition *Definition Used bool `dump:"-"` }
type VariableDefinitionList ¶
type VariableDefinitionList []*VariableDefinition
func (VariableDefinitionList) ForName ¶
func (l VariableDefinitionList) ForName(name string) *VariableDefinition