ast

package
v0.5.1 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jul 5, 2021 License: MIT Imports: 3 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// Executable directive locations
	QueryDirectiveLocation              string = "QUERY"
	MutationDirectiveLocation           string = "MUTATION"
	SubscriptionDirectiveLocation       string = "SUBSCRIPTION"
	FieldDirectiveLocation              string = "FIELD"
	FragmentDefinitionDirectiveLocation string = "FRAGMENT_DEFINITION"
	FragmentSpreadDirectiveLocation     string = "FRAGMENT_SPREAD"
	InlineFragmentDirectiveLocation     string = "INLINE_FRAGMENT"

	// TypeSystem directive locations
	SchemaDirectiveLocation               string = "SCHEMA"
	ScalarDirectiveLocation               string = "SCALAR"
	ObjectDirectiveLocation               string = "OBJECT"
	FieldDefinitionDirectiveLocation      string = "FIELD_DEFINITION"
	ArguentDefinitionDirectiveLocation    string = "ARGUMENT_DEFINITION"
	InterfaceDirectiveLocation            string = "INTERFACE"
	UnionDirectiveLocation                string = "UNION"
	EnumDirectiveLocation                 string = "ENUM"
	EnumValueDirectiveLocation            string = "ENUM_VALUE"
	InputObjectDirectiveLocation          string = "INPUT_OBJECT"
	InputFieldDefinitionDirectiveLocation string = "INPUT_FIELD_DEFINITION"
)

Variables

This section is empty.

Functions

func IsValidDirective added in v0.3.1

func IsValidDirective(d string) bool

Types

type Argument

type Argument struct {
	Name     string
	Value    Value
	Location Location
}

type BooleanValue

type BooleanValue struct {
	Value    string
	Location Location
}

func (*BooleanValue) GetLocation added in v0.2.0

func (v *BooleanValue) GetLocation() Location

func (*BooleanValue) GetValue

func (v *BooleanValue) GetValue() interface{}

func (*BooleanValue) Kind

func (v *BooleanValue) Kind() ValueKind

func (*BooleanValue) String added in v0.5.0

func (v *BooleanValue) String() string

type Definition added in v0.3.1

type Definition interface {
	Kind() DefinitionKind
	String() string
}

type DefinitionKind added in v0.3.1

type DefinitionKind uint
const (
	SchemaKind DefinitionKind = iota
	ScalarKind
	ObjectKind
	InterfaceKind
	UnionKind
	EnumKind
	InputObjectKind
	DirectiveKind
)

type Directive

type Directive struct {
	Name      string
	Arguments []*Argument
	Location  Location
}

func (*Directive) String added in v0.5.0

func (d *Directive) String() string

type DirectiveDefinition added in v0.3.1

type DirectiveDefinition struct {
	Description string
	Name        string
	Locations   []string
	Arguments   []*InputValueDefinition
}

func (*DirectiveDefinition) Kind added in v0.3.1

func (*DirectiveDefinition) String added in v0.5.0

func (d *DirectiveDefinition) String() string

type Document

type Document struct {
	Operations  []*Operation
	Fragments   []*Fragment
	Definitions []Definition
}

func NewDocument

func NewDocument() *Document

type EnumDefinition added in v0.3.1

type EnumDefinition struct {
	Description string
	Name        string
	Directives  []*Directive
	Values      []*EnumValueDefinition
}

func (*EnumDefinition) Kind added in v0.3.1

func (d *EnumDefinition) Kind() DefinitionKind

func (*EnumDefinition) String added in v0.5.0

func (d *EnumDefinition) String() string

type EnumValue

type EnumValue struct {
	Value    string
	Location Location
}

func (*EnumValue) GetLocation added in v0.2.0

func (v *EnumValue) GetLocation() Location

func (*EnumValue) GetValue

func (v *EnumValue) GetValue() interface{}

func (*EnumValue) Kind

func (v *EnumValue) Kind() ValueKind

func (*EnumValue) String added in v0.5.0

func (v *EnumValue) String() string

type EnumValueDefinition added in v0.3.1

type EnumValueDefinition struct {
	Description string
	Value       *EnumValue
	Directives  []*Directive
}

type Field

type Field struct {
	Alias        string
	Name         string
	ParentType   string
	Arguments    []*Argument
	Directives   []*Directive
	SelectionSet []Selection
	Location     Location
}

func (*Field) GetDirectives

func (f *Field) GetDirectives() []*Directive

func (*Field) Kind

func (f *Field) Kind() SelectionKind

type FieldDefinition added in v0.3.1

type FieldDefinition struct {
	Description string
	Name        string
	Arguments   []*InputValueDefinition
	Type        Type
	Directives  []*Directive
}

func (*FieldDefinition) String added in v0.5.0

func (d *FieldDefinition) String() string

type Fields

type Fields []*Field

type FloatValue

type FloatValue struct {
	Value    string
	Location Location
}

func (*FloatValue) GetLocation added in v0.2.0

func (v *FloatValue) GetLocation() Location

func (*FloatValue) GetValue

func (v *FloatValue) GetValue() interface{}

func (*FloatValue) Kind

func (v *FloatValue) Kind() ValueKind

func (*FloatValue) String added in v0.5.0

func (v *FloatValue) String() string

type Fragment

type Fragment struct {
	Name          string
	TypeCondition string
	Directives    []*Directive
	SelectionSet  []Selection
	Location      Location
}

type FragmentSpread

type FragmentSpread struct {
	Name       string
	Directives []*Directive
	Location   Location
}

func (*FragmentSpread) GetDirectives

func (fs *FragmentSpread) GetDirectives() []*Directive

func (*FragmentSpread) Kind

func (fs *FragmentSpread) Kind() SelectionKind

type InlineFragment

type InlineFragment struct {
	TypeCondition string
	Directives    []*Directive
	SelectionSet  []Selection
	Location      Location
}

func (*InlineFragment) GetDirectives

func (inf *InlineFragment) GetDirectives() []*Directive

func (*InlineFragment) Kind

func (inf *InlineFragment) Kind() SelectionKind

type InputObjectDefinition added in v0.3.1

type InputObjectDefinition struct {
	Description string
	Name        string
	Directives  []*Directive
	Fields      []*InputValueDefinition
}

func (*InputObjectDefinition) Kind added in v0.3.1

func (*InputObjectDefinition) String added in v0.5.0

func (d *InputObjectDefinition) String() string

type InputValueDefinition added in v0.3.1

type InputValueDefinition struct {
	Description  string
	Name         string
	Type         Type
	DefaultValue Value
	Directives   []*Directive
}

func (*InputValueDefinition) String added in v0.5.0

func (d *InputValueDefinition) String() string

type IntValue

type IntValue struct {
	Value    string
	Location Location
}

func (*IntValue) GetLocation added in v0.2.0

func (v *IntValue) GetLocation() Location

func (*IntValue) GetValue

func (v *IntValue) GetValue() interface{}

func (*IntValue) Kind

func (v *IntValue) Kind() ValueKind

func (*IntValue) String added in v0.5.0

func (v *IntValue) String() string

type InterfaceDefinition added in v0.3.1

type InterfaceDefinition struct {
	Description string
	Name        string
	Directives  []*Directive
	Fields      []*FieldDefinition
}

func (*InterfaceDefinition) Kind added in v0.3.1

func (*InterfaceDefinition) String added in v0.5.0

func (d *InterfaceDefinition) String() string

type ListType

type ListType struct {
	Type
	Location Location
}

func (*ListType) GetValue

func (t *ListType) GetValue() interface{}

func (*ListType) Kind

func (t *ListType) Kind() TypeKind

func (*ListType) String added in v0.5.0

func (t *ListType) String() string

type ListValue

type ListValue struct {
	Values   []Value
	Location Location
}

func (*ListValue) GetLocation added in v0.2.0

func (v *ListValue) GetLocation() Location

func (*ListValue) GetValue

func (v *ListValue) GetValue() interface{}

func (*ListValue) Kind

func (v *ListValue) Kind() ValueKind

func (*ListValue) String added in v0.5.0

func (v *ListValue) String() string

type Location

type Location struct {
	Column int
	Line   int
}

type NamedType

type NamedType struct {
	Name     string
	Location Location
}

func (*NamedType) GetValue

func (t *NamedType) GetValue() interface{}

func (*NamedType) Kind

func (t *NamedType) Kind() TypeKind

func (*NamedType) String added in v0.5.0

func (t *NamedType) String() string

type NonNullType

type NonNullType struct {
	Type
	Location Location
}

func (*NonNullType) GetValue

func (t *NonNullType) GetValue() interface{}

func (*NonNullType) Kind

func (t *NonNullType) Kind() TypeKind

func (*NonNullType) String added in v0.5.0

func (t *NonNullType) String() string

type NullValue

type NullValue struct {
	Value    string
	Location Location
}

func (*NullValue) GetLocation added in v0.2.0

func (v *NullValue) GetLocation() Location

func (*NullValue) GetValue

func (v *NullValue) GetValue() interface{}

func (*NullValue) Kind

func (v *NullValue) Kind() ValueKind

func (*NullValue) String added in v0.5.0

func (v *NullValue) String() string

type ObjectDefinition added in v0.3.1

type ObjectDefinition struct {
	Description string
	Name        string
	Implements  []*NamedType
	Directives  []*Directive
	Fields      []*FieldDefinition
}

func (*ObjectDefinition) Kind added in v0.3.1

func (d *ObjectDefinition) Kind() DefinitionKind

func (*ObjectDefinition) String added in v0.5.0

func (d *ObjectDefinition) String() string

type ObjectFieldValue

type ObjectFieldValue struct {
	Name     string
	Value    Value
	Location Location
}

func (*ObjectFieldValue) GetLocation added in v0.2.0

func (v *ObjectFieldValue) GetLocation() Location

func (*ObjectFieldValue) GetValue

func (v *ObjectFieldValue) GetValue() interface{}

func (*ObjectFieldValue) Kind

func (v *ObjectFieldValue) Kind() ValueKind

func (*ObjectFieldValue) String added in v0.5.0

func (v *ObjectFieldValue) String() string

type ObjectValue

type ObjectValue struct {
	Fields   []*ObjectFieldValue
	Location Location
}

func (*ObjectValue) GetLocation added in v0.2.0

func (v *ObjectValue) GetLocation() Location

func (*ObjectValue) GetValue

func (v *ObjectValue) GetValue() interface{}

func (*ObjectValue) Kind

func (v *ObjectValue) Kind() ValueKind

func (*ObjectValue) String added in v0.5.0

func (v *ObjectValue) String() string

type Operation

type Operation struct {
	OperationType OperationType
	Name          string
	Variables     []*Variable
	Directives    []*Directive
	SelectionSet  []Selection
	Location      Location
}

func NewOperation

func NewOperation(ot OperationType) *Operation

type OperationType

type OperationType int
const (
	Query OperationType = iota
	Mutation
	Subscription
)

type ScalarDefinition added in v0.3.1

type ScalarDefinition struct {
	Description string
	Name        string
	Directives  []*Directive
}

func (*ScalarDefinition) Kind added in v0.3.1

func (d *ScalarDefinition) Kind() DefinitionKind

func (*ScalarDefinition) String added in v0.5.0

func (d *ScalarDefinition) String() string

type SchemaDefinition added in v0.3.1

type SchemaDefinition struct {
	Name           string
	Directives     []*Directive
	RootOperations map[OperationType]*NamedType
}

func (*SchemaDefinition) Kind added in v0.3.1

func (d *SchemaDefinition) Kind() DefinitionKind

func (*SchemaDefinition) String added in v0.5.0

func (d *SchemaDefinition) String() string

type Selection

type Selection interface {
	Kind() SelectionKind
	GetDirectives() []*Directive
}

type SelectionKind

type SelectionKind int
const (
	FieldSelectionKind SelectionKind = iota
	FragmentSpreadSelectionKind
	InlineFragmentSelectionKind
)

type StringValue

type StringValue struct {
	Value    string
	Location Location
}

func (*StringValue) GetLocation added in v0.2.0

func (v *StringValue) GetLocation() Location

func (*StringValue) GetValue

func (v *StringValue) GetValue() interface{}

func (*StringValue) Kind

func (v *StringValue) Kind() ValueKind

func (*StringValue) String added in v0.5.0

func (v *StringValue) String() string

type Type

type Type interface {
	Kind() TypeKind
	GetValue() interface{}
	String() string
}

type TypeKind

type TypeKind int
const (
	Named TypeKind = iota
	List
	NonNull
)

type UnionDefinition added in v0.3.1

type UnionDefinition struct {
	Description string
	Name        string
	Directives  []*Directive
	Members     []*NamedType
}

func (*UnionDefinition) Kind added in v0.3.1

func (d *UnionDefinition) Kind() DefinitionKind

func (*UnionDefinition) String added in v0.5.0

func (d *UnionDefinition) String() string

type Value

type Value interface {
	GetValue() interface{}
	Kind() ValueKind
	GetLocation() Location
	String() string
}

type ValueKind

type ValueKind int
const (
	VariableValueKind ValueKind = iota
	IntValueKind
	FloatValueKind
	BooleanValueKind
	StringValueKind
	NullValueKind
	EnumValueKind
	ListValueKind
	ObjectValueKind
	ObjectFieldValueKind
)

type Variable

type Variable struct {
	Name         string
	Type         Type
	DefaultValue Value
	Location     Location
}

type VariableValue

type VariableValue struct {
	Name     string
	Location Location
}

func (*VariableValue) GetLocation added in v0.2.0

func (v *VariableValue) GetLocation() Location

func (*VariableValue) GetValue

func (v *VariableValue) GetValue() interface{}

func (*VariableValue) Kind

func (v *VariableValue) Kind() ValueKind

func (*VariableValue) String added in v0.5.0

func (v *VariableValue) String() string

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL