ast

package
v1.0.4 Latest Latest
Warning

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

Go to latest
Published: Aug 16, 2022 License: MIT Imports: 16 Imported by: 0

Documentation

Overview

Package ast defines the GraphQL AST and offers helper methods to interact with the AST, mostly to get the necessary information from the ast.

The document struct is designed in a way to enable performant parsing while keeping the ast easy to use with helper methods.

Index

Examples

Constants

View Source
const InvalidRef = -1

Variables

View Source
var DefaultMutationTypeName = []byte("Mutation")
View Source
var DefaultQueryTypeName = []byte("Query")
View Source
var DefaultSubscriptionTypeName = []byte("Subscription")
View Source
var InvalidNode = Node{Kind: NodeKindUnknown, Ref: InvalidRef}

Functions

func ByteSliceEquals

func ByteSliceEquals(left ByteSliceReference, leftInput Input, right ByteSliceReference, rightInput Input) bool

ByteSliceEquals compares two ByteSliceReferences from different Inputs

func FilterIntSliceByWhitelist

func FilterIntSliceByWhitelist(intSlice []int, whitelist []int) []int

func IsRootType

func IsRootType(nameBytes []byte) bool

Types

type Alias

type Alias struct {
	IsDefined bool
	Name      ByteSliceReference // optional, e.g. renamedField
	Colon     position.Position  // :
}

type Argument

type Argument struct {
	Name  ByteSliceReference // e.g. foo
	Colon position.Position  // :
	Value Value              // e.g. 100 or "Bar"
}

type ArgumentList

type ArgumentList struct {
	LPAREN position.Position
	Refs   []int // Argument
	RPAREN position.Position
}

type BooleanValue

type BooleanValue bool

BooleanValues one of: true, false

type ByteSlice

type ByteSlice []byte

ByteSlice is an alias for []byte

func (ByteSlice) Equals

func (b ByteSlice) Equals(another ByteSlice) bool

Equals compares a ByteSlice to another

func (ByteSlice) MarshalJSON

func (b ByteSlice) MarshalJSON() ([]byte, error)

func (ByteSlice) String

func (b ByteSlice) String() string

type ByteSliceReference

type ByteSliceReference struct {
	Start uint32
	End   uint32
}

func (ByteSliceReference) Length

func (b ByteSliceReference) Length() uint32

type ByteSliceReferences

type ByteSliceReferences []ByteSliceReference

func (ByteSliceReferences) String

func (b ByteSliceReferences) String(input *Input) string

type ByteSlices

type ByteSlices []ByteSlice

func (ByteSlices) String

func (b ByteSlices) String() string

type DefaultValue

type DefaultValue struct {
	IsDefined bool
	Equals    position.Position // =
	Value     Value             // e.g. "Foo"
}

type Description

type Description struct {
	IsDefined     bool
	IsBlockString bool               // true if -> """content""" ; else "content"
	Content       ByteSliceReference // literal
	Position      position.Position
}

type Directive

type Directive struct {
	At           position.Position  // @
	Name         ByteSliceReference // e.g. include
	HasArguments bool
	Arguments    ArgumentList // e.g. (if: true)
}

type DirectiveDefinition

type DirectiveDefinition struct {
	Description             Description        // optional, describes the directive
	DirectiveLiteral        position.Position  // directive
	At                      position.Position  // @
	Name                    ByteSliceReference // e.g. example
	HasArgumentsDefinitions bool
	ArgumentsDefinition     InputValueDefinitionList // optional, e.g. (if: Boolean)
	On                      position.Position        // on
	DirectiveLocations      DirectiveLocations       // e.g. FIELD
	Repeatable              Repeatable
}

DirectiveDefinition example: directive @example on FIELD

type DirectiveList

type DirectiveList struct {
	Refs []int
}

func (*DirectiveList) HasDirectiveByName

func (l *DirectiveList) HasDirectiveByName(document *Document, name string) bool

func (*DirectiveList) RemoveDirectiveByName

func (l *DirectiveList) RemoveDirectiveByName(document *Document, name string)

type DirectiveLocation

type DirectiveLocation int
const (
	DirectiveLocationUnknown DirectiveLocation = iota
	ExecutableDirectiveLocationQuery
	ExecutableDirectiveLocationMutation
	ExecutableDirectiveLocationSubscription
	ExecutableDirectiveLocationField
	ExecutableDirectiveLocationFragmentDefinition
	ExecutableDirectiveLocationFragmentSpread
	ExecutableDirectiveLocationInlineFragment
	ExecutableDirectiveLocationVariableDefinition

	TypeSystemDirectiveLocationSchema
	TypeSystemDirectiveLocationScalar
	TypeSystemDirectiveLocationObject
	TypeSystemDirectiveLocationFieldDefinition
	TypeSystemDirectiveLocationArgumentDefinition
	TypeSystemDirectiveLocationInterface
	TypeSystemDirectiveLocationUnion
	TypeSystemDirectiveLocationEnum
	TypeSystemDirectiveLocationEnumValue
	TypeSystemDirectiveLocationInputObject
	TypeSystemDirectiveLocationInputFieldDefinition
)

func (DirectiveLocation) LiteralBytes

func (d DirectiveLocation) LiteralBytes() ByteSlice

func (DirectiveLocation) LiteralString

func (d DirectiveLocation) LiteralString() string

func (DirectiveLocation) String

func (d DirectiveLocation) String() string

type DirectiveLocationIterable

type DirectiveLocationIterable struct {
	// contains filtered or unexported fields
}

func (*DirectiveLocationIterable) Next

func (d *DirectiveLocationIterable) Next() bool

func (*DirectiveLocationIterable) Value

type DirectiveLocations

type DirectiveLocations struct {
	// contains filtered or unexported fields
}

func (*DirectiveLocations) Get

func (d *DirectiveLocations) Get(location DirectiveLocation) bool

func (*DirectiveLocations) Iterable

func (*DirectiveLocations) Set

func (d *DirectiveLocations) Set(location DirectiveLocation)

func (*DirectiveLocations) SetFromRaw

func (d *DirectiveLocations) SetFromRaw(bytes []byte) error

func (*DirectiveLocations) Unset

func (d *DirectiveLocations) Unset(location DirectiveLocation)

type Document

type Document struct {
	Input                        Input
	RootNodes                    []Node
	SchemaDefinitions            []SchemaDefinition
	SchemaExtensions             []SchemaExtension
	RootOperationTypeDefinitions []RootOperationTypeDefinition
	Directives                   []Directive
	Arguments                    []Argument
	ObjectTypeDefinitions        []ObjectTypeDefinition
	ObjectTypeExtensions         []ObjectTypeExtension
	FieldDefinitions             []FieldDefinition
	Types                        []Type
	InputValueDefinitions        []InputValueDefinition
	InputObjectTypeDefinitions   []InputObjectTypeDefinition
	InputObjectTypeExtensions    []InputObjectTypeExtension
	ScalarTypeDefinitions        []ScalarTypeDefinition
	ScalarTypeExtensions         []ScalarTypeExtension
	InterfaceTypeDefinitions     []InterfaceTypeDefinition
	InterfaceTypeExtensions      []InterfaceTypeExtension
	UnionTypeDefinitions         []UnionTypeDefinition
	UnionTypeExtensions          []UnionTypeExtension
	EnumTypeDefinitions          []EnumTypeDefinition
	EnumTypeExtensions           []EnumTypeExtension
	EnumValueDefinitions         []EnumValueDefinition
	DirectiveDefinitions         []DirectiveDefinition
	Values                       []Value
	ListValues                   []ListValue
	VariableValues               []VariableValue
	StringValues                 []StringValue
	IntValues                    []IntValue
	FloatValues                  []FloatValue
	EnumValues                   []EnumValue
	ObjectFields                 []ObjectField
	ObjectValues                 []ObjectValue
	Selections                   []Selection
	SelectionSets                []SelectionSet
	Fields                       []Field
	InlineFragments              []InlineFragment
	FragmentSpreads              []FragmentSpread
	OperationDefinitions         []OperationDefinition
	VariableDefinitions          []VariableDefinition
	FragmentDefinitions          []FragmentDefinition
	BooleanValues                [2]BooleanValue
	Refs                         [][8]int
	RefIndex                     int
	Index                        Index
}
Example

Create a new Document without pre-initializing slices. Use this if you want to manually create a new Document

package main

import (
	"github.com/maronavenue/graphql-go-tools/pkg/ast"
)

func main() {
	// create the same doc as in NewDocument() example but manually.

	doc := &ast.Document{}

	// add Query to the raw input
	queryTypeName := doc.Input.AppendInputString("Query")

	// create a RootOperationTypeDefinition
	rootOperationTypeDefinition := ast.RootOperationTypeDefinition{
		OperationType: ast.OperationTypeQuery,
		NamedType: ast.Type{
			Name: queryTypeName,
		},
	}

	// add the RootOperationTypeDefinition to the ast
	doc.RootOperationTypeDefinitions = append(doc.RootOperationTypeDefinitions, rootOperationTypeDefinition)
	// get a reference to the RootOperationTypeDefinition
	queryRootOperationTypeRef := len(doc.RootOperationTypeDefinitions) - 1

	// create a SchemaDefinition
	schemaDefinition := ast.SchemaDefinition{
		RootOperationTypeDefinitions: ast.RootOperationTypeDefinitionList{
			// add the RootOperationTypeDefinition reference
			Refs: []int{queryRootOperationTypeRef},
		},
	}

	// add the SchemaDefinition to the ast
	doc.SchemaDefinitions = append(doc.SchemaDefinitions, schemaDefinition)
	// get a reference to the SchemaDefinition
	schemaDefinitionRef := len(doc.SchemaDefinitions) - 1

	// add the SchemaDefinition to the RootNodes
	// all root level nodes have to be added to the RootNodes slice in order to make them available to the Walker for traversal
	doc.RootNodes = append(doc.RootNodes, ast.Node{Kind: ast.NodeKindSchemaDefinition, Ref: schemaDefinitionRef})

	// add another string to the raw input
	stringName := doc.Input.AppendInputString("String")

	// create a named Type
	stringType := ast.Type{
		TypeKind: ast.TypeKindNamed,
		Name:     stringName,
	}

	// add the Type to the ast
	doc.Types = append(doc.Types, stringType)
	// get a reference to the Type
	stringTypeRef := len(doc.Types) - 1

	// create another Type
	nonNullStringType := ast.Type{
		TypeKind: ast.TypeKindNonNull,
		// add a reference to the named type
		OfType: stringTypeRef,
	}
	// Result: NonNull String / String!

	// add the Type to the ast
	doc.Types = append(doc.Types, nonNullStringType)
	// get a reference to the Type
	nonNullStringTypeRef := len(doc.Types) - 1

	// add another string to the raw input
	helloName := doc.Input.AppendInputString("hello")

	// create a FieldDefinition
	helloFieldDefinition := ast.FieldDefinition{
		Name: helloName,
		// add the Type reference
		Type: nonNullStringTypeRef,
	}

	// add the FieldDefinition to the ast
	doc.FieldDefinitions = append(doc.FieldDefinitions, helloFieldDefinition)
	// get a reference to the FieldDefinition
	helloFieldDefinitionRef := len(doc.FieldDefinitions) - 1

	// create an ObjectTypeDefinition
	queryTypeDefinition := ast.ObjectTypeDefinition{
		Name: queryTypeName,
		// declare that this ObjectTypeDefinition has fields
		// this is necessary for the Walker to understand it must walk FieldDefinitions
		HasFieldDefinitions: true,
		FieldsDefinition: ast.FieldDefinitionList{
			// add the FieldDefinition reference
			Refs: []int{helloFieldDefinitionRef},
		},
	}

	// add ObjectTypeDefinition to the ast
	doc.ObjectTypeDefinitions = append(doc.ObjectTypeDefinitions, queryTypeDefinition)
	// get reference to ObjectTypeDefinition
	queryTypeRef := len(doc.ObjectTypeDefinitions) - 1

	// add ObjectTypeDefinition to the RootNodes
	doc.RootNodes = append(doc.RootNodes, ast.Node{Kind: ast.NodeKindObjectTypeDefinition, Ref: queryTypeRef})
}
Output:

func NewDocument

func NewDocument() *Document
Example

Create a new document with initialized slices. In case you're on a hot path you always want to use a pre-initialized Document.

package main

import (
	"github.com/maronavenue/graphql-go-tools/pkg/ast"
)

func main() {
	schema := []byte(`
		schema {
			query: Query
		}
		
		type Query {
			hello: String!
		}
	`)

	doc := ast.NewDocument()
	doc.Input.ResetInputBytes(schema)

	// ...then parse the Input
}
Output:

func (*Document) AddArgument

func (d *Document) AddArgument(argument Argument) (ref int)

func (*Document) AddArgumentToField

func (d *Document) AddArgumentToField(fieldRef, argRef int)

func (*Document) AddDirective

func (d *Document) AddDirective(directive Directive) (ref int)

func (*Document) AddDirectiveDefinition

func (d *Document) AddDirectiveDefinition(directiveDefinition DirectiveDefinition) (ref int)

func (*Document) AddDirectiveToNode

func (d *Document) AddDirectiveToNode(directiveRef int, node Node) bool

func (*Document) AddEnumTypeDefinition

func (d *Document) AddEnumTypeDefinition(definition EnumTypeDefinition) (ref int)

func (*Document) AddEnumValue

func (d *Document) AddEnumValue(value EnumValue) (ref int)

func (*Document) AddEnumValueDefinition

func (d *Document) AddEnumValueDefinition(inputValueDefinition EnumValueDefinition) (ref int)

func (*Document) AddField

func (d *Document) AddField(field Field) Node

func (*Document) AddFieldDefinition

func (d *Document) AddFieldDefinition(fieldDefinition FieldDefinition) (ref int)

func (*Document) AddFloatValue

func (d *Document) AddFloatValue(value FloatValue) (ref int)

func (*Document) AddFragmentSpread

func (d *Document) AddFragmentSpread(spread FragmentSpread) int

func (*Document) AddImportedVariableDefinitionToOperationDefinition

func (d *Document) AddImportedVariableDefinitionToOperationDefinition(operationDefinition, variableDefinition int)

func (*Document) AddInlineFragment

func (d *Document) AddInlineFragment(fragment InlineFragment) int

func (*Document) AddInputObjectTypeDefinition

func (d *Document) AddInputObjectTypeDefinition(definition InputObjectTypeDefinition) (ref int)

func (*Document) AddInputValueDefinition

func (d *Document) AddInputValueDefinition(inputValueDefinition InputValueDefinition) (ref int)

func (*Document) AddIntValue

func (d *Document) AddIntValue(value IntValue) (ref int)

func (*Document) AddInterfaceTypeDefinition

func (d *Document) AddInterfaceTypeDefinition(definition InterfaceTypeDefinition) (ref int)

func (*Document) AddInterfaceTypeExtension

func (d *Document) AddInterfaceTypeExtension(extension InterfaceTypeExtension) (ref int)

func (*Document) AddListType

func (d *Document) AddListType(ofType int) (ref int)

func (*Document) AddListTypeWithPosition

func (d *Document) AddListTypeWithPosition(ofType int, open position.Position, close position.Position) (ref int)

func (*Document) AddListValue

func (d *Document) AddListValue(value ListValue) (ref int)

func (*Document) AddNamedType

func (d *Document) AddNamedType(name []byte) (ref int)

func (*Document) AddNamedTypeByNameRef

func (d *Document) AddNamedTypeByNameRef(nameRef ByteSliceReference) (ref int)

func (*Document) AddNonNullNamedType

func (d *Document) AddNonNullNamedType(name []byte) (ref int)

func (*Document) AddNonNullType

func (d *Document) AddNonNullType(ofType int) (ref int)

func (*Document) AddNonNullTypeWithPosition

func (d *Document) AddNonNullTypeWithPosition(ofType int, bang position.Position) (ref int)

func (*Document) AddObjectField

func (d *Document) AddObjectField(field ObjectField) (ref int)

func (*Document) AddObjectTypeDefinition

func (d *Document) AddObjectTypeDefinition(definition ObjectTypeDefinition) (ref int)

func (*Document) AddObjectTypeDefinitionExtension

func (d *Document) AddObjectTypeDefinitionExtension(extension ObjectTypeExtension) (ref int)

func (*Document) AddObjectValue

func (d *Document) AddObjectValue(value ObjectValue) (ref int)

func (*Document) AddOperationDefinitionToRootNodes

func (d *Document) AddOperationDefinitionToRootNodes(definition OperationDefinition) Node

func (*Document) AddRootNode

func (d *Document) AddRootNode(node Node)

func (*Document) AddRootOperationTypeDefinition

func (d *Document) AddRootOperationTypeDefinition(rootOperationTypeDefinition RootOperationTypeDefinition) (ref int)

func (*Document) AddScalarTypeDefinition

func (d *Document) AddScalarTypeDefinition(definition ScalarTypeDefinition) (ref int)

func (*Document) AddSchemaDefinition

func (d *Document) AddSchemaDefinition(schemaDefinition SchemaDefinition) (ref int)

func (*Document) AddSchemaDefinitionRootNode

func (d *Document) AddSchemaDefinitionRootNode(schemaDefinition SchemaDefinition)

func (*Document) AddSelection

func (d *Document) AddSelection(set int, selection Selection)

func (*Document) AddSelectionSet

func (d *Document) AddSelectionSet() Node

func (*Document) AddSelectionSetToDocument

func (d *Document) AddSelectionSetToDocument(set SelectionSet) int

func (*Document) AddSelectionToDocument

func (d *Document) AddSelectionToDocument(selection Selection) int

func (*Document) AddStringValue

func (d *Document) AddStringValue(value StringValue) (ref int)

func (*Document) AddType

func (d *Document) AddType(t Type) (ref int)

func (*Document) AddUnionTypeDefinition

func (d *Document) AddUnionTypeDefinition(definition UnionTypeDefinition) (ref int)

func (*Document) AddValue

func (d *Document) AddValue(value Value) (ref int)

func (*Document) AddVariableDefinitionToOperationDefinition

func (d *Document) AddVariableDefinitionToOperationDefinition(operationDefinitionRef, variableValueRef, typeRef int)

func (*Document) AddVariableValue

func (d *Document) AddVariableValue(value VariableValue) (ref int)

func (*Document) AddVariableValueArgument

func (d *Document) AddVariableValueArgument(argName, variableName []byte) (variableValueRef, argRef int)

func (*Document) AppendSelectionSet

func (d *Document) AppendSelectionSet(ref int, appendRef int)

func (*Document) ArgumentNameBytes

func (d *Document) ArgumentNameBytes(ref int) ByteSlice

func (*Document) ArgumentNameString

func (d *Document) ArgumentNameString(ref int) string

func (*Document) ArgumentSetsAreEquals

func (d *Document) ArgumentSetsAreEquals(left, right []int) bool

func (*Document) ArgumentValue

func (d *Document) ArgumentValue(ref int) Value

func (*Document) ArgumentsAfter

func (d *Document) ArgumentsAfter(ancestor Node, argument int) []int

func (*Document) ArgumentsAreEqual

func (d *Document) ArgumentsAreEqual(left, right int) bool

func (*Document) ArgumentsBefore

func (d *Document) ArgumentsBefore(ancestor Node, argument int) []int

func (*Document) BooleanValue

func (d *Document) BooleanValue(ref int) BooleanValue

func (*Document) BooleanValuesAreEqual

func (d *Document) BooleanValuesAreEqual(left, right int) bool

func (*Document) CopyAlias

func (d *Document) CopyAlias(alias Alias) Alias

func (*Document) CopyArgument

func (d *Document) CopyArgument(ref int) int

func (*Document) CopyArgumentList

func (d *Document) CopyArgumentList(list ArgumentList) ArgumentList

func (*Document) CopyDirective

func (d *Document) CopyDirective(ref int) int

func (*Document) CopyDirectiveList

func (d *Document) CopyDirectiveList(list DirectiveList) DirectiveList

func (*Document) CopyEnumValue

func (d *Document) CopyEnumValue(ref int) int

func (*Document) CopyField

func (d *Document) CopyField(ref int) int

func (*Document) CopyFloatValue

func (d *Document) CopyFloatValue(ref int) int

func (*Document) CopyFragmentSpread

func (d *Document) CopyFragmentSpread(ref int) int

func (*Document) CopyInlineFragment

func (d *Document) CopyInlineFragment(ref int) int

func (*Document) CopyIntValue

func (d *Document) CopyIntValue(ref int) int

func (*Document) CopyListValue

func (d *Document) CopyListValue(ref int) int

func (*Document) CopyObjectField

func (d *Document) CopyObjectField(ref int) int

func (*Document) CopyObjectValue

func (d *Document) CopyObjectValue(ref int) int

func (*Document) CopySelection

func (d *Document) CopySelection(ref int) int

func (*Document) CopySelectionSet

func (d *Document) CopySelectionSet(ref int) int

func (*Document) CopyStringValue

func (d *Document) CopyStringValue(ref int) int

func (*Document) CopyValue

func (d *Document) CopyValue(ref int) int

func (*Document) CopyVariableValue

func (d *Document) CopyVariableValue(ref int) int

func (*Document) CreateRootOperationTypeDefinition

func (d *Document) CreateRootOperationTypeDefinition(operationType OperationType, rootNodeRef int) (ref int)

func (*Document) DeleteRootNode

func (d *Document) DeleteRootNode(node Node)

func (*Document) DeleteRootNodes

func (d *Document) DeleteRootNodes(nodes []Node)

func (*Document) DirectiveArgumentInputValueDefinition

func (d *Document) DirectiveArgumentInputValueDefinition(directiveName ByteSlice, argumentName ByteSlice) int

func (*Document) DirectiveArgumentSet

func (d *Document) DirectiveArgumentSet(ref int) []int

func (*Document) DirectiveArgumentValueByName

func (d *Document) DirectiveArgumentValueByName(ref int, name ByteSlice) (Value, bool)

func (*Document) DirectiveDefinitionArgumentDefaultValueBool

func (d *Document) DirectiveDefinitionArgumentDefaultValueBool(directiveName, argumentName string) bool

func (*Document) DirectiveDefinitionArgumentDefaultValueFloat32

func (d *Document) DirectiveDefinitionArgumentDefaultValueFloat32(directiveName, argumentName string) float32

func (*Document) DirectiveDefinitionArgumentDefaultValueInt64

func (d *Document) DirectiveDefinitionArgumentDefaultValueInt64(directiveName, argumentName string) int64

func (*Document) DirectiveDefinitionArgumentDefaultValueString

func (d *Document) DirectiveDefinitionArgumentDefaultValueString(directiveName, argumentName string) string

func (*Document) DirectiveDefinitionByName

func (d *Document) DirectiveDefinitionByName(name string) (int, bool)

func (*Document) DirectiveDefinitionDescriptionBytes

func (d *Document) DirectiveDefinitionDescriptionBytes(ref int) ByteSlice

func (*Document) DirectiveDefinitionDescriptionString

func (d *Document) DirectiveDefinitionDescriptionString(ref int) string

func (*Document) DirectiveDefinitionNameBytes

func (d *Document) DirectiveDefinitionNameBytes(ref int) ByteSlice

func (*Document) DirectiveDefinitionNameString

func (d *Document) DirectiveDefinitionNameString(ref int) string

func (*Document) DirectiveIsAllowedOnNodeKind

func (d *Document) DirectiveIsAllowedOnNodeKind(directiveName string, kind NodeKind, operationType OperationType) bool

func (*Document) DirectiveIsFirst

func (d *Document) DirectiveIsFirst(directive int, ancestor Node) bool

func (*Document) DirectiveIsLast

func (d *Document) DirectiveIsLast(directive int, ancestor Node) bool

func (*Document) DirectiveName

func (d *Document) DirectiveName(ref int) ByteSliceReference

func (*Document) DirectiveNameBytes

func (d *Document) DirectiveNameBytes(ref int) ByteSlice

func (*Document) DirectiveNameString

func (d *Document) DirectiveNameString(ref int) string

func (*Document) DirectiveSetsAreEqual

func (d *Document) DirectiveSetsAreEqual(left, right []int) bool

func (*Document) DirectivesAreEqual

func (d *Document) DirectivesAreEqual(left, right int) bool

func (*Document) EmptySelectionSet

func (d *Document) EmptySelectionSet(ref int)

func (*Document) EnumTypeDefinitionContainsEnumValue

func (d *Document) EnumTypeDefinitionContainsEnumValue(enumTypeDef int, valueName ByteSlice) bool

func (*Document) EnumTypeDefinitionDescriptionBytes

func (d *Document) EnumTypeDefinitionDescriptionBytes(ref int) ByteSlice

func (*Document) EnumTypeDefinitionDescriptionString

func (d *Document) EnumTypeDefinitionDescriptionString(ref int) string

func (*Document) EnumTypeDefinitionHasDirectives

func (d *Document) EnumTypeDefinitionHasDirectives(ref int) bool

func (*Document) EnumTypeDefinitionHasEnumValueDefinition

func (d *Document) EnumTypeDefinitionHasEnumValueDefinition(ref int) bool

func (*Document) EnumTypeDefinitionNameBytes

func (d *Document) EnumTypeDefinitionNameBytes(ref int) ByteSlice

func (*Document) EnumTypeDefinitionNameString

func (d *Document) EnumTypeDefinitionNameString(ref int) string

func (*Document) EnumTypeExtensionDescriptionBytes

func (d *Document) EnumTypeExtensionDescriptionBytes(ref int) ByteSlice

func (*Document) EnumTypeExtensionDescriptionString

func (d *Document) EnumTypeExtensionDescriptionString(ref int) string

func (*Document) EnumTypeExtensionHasDirectives

func (d *Document) EnumTypeExtensionHasDirectives(ref int) bool

func (*Document) EnumTypeExtensionHasEnumValueDefinition

func (d *Document) EnumTypeExtensionHasEnumValueDefinition(ref int) bool

func (*Document) EnumTypeExtensionNameBytes

func (d *Document) EnumTypeExtensionNameBytes(ref int) ByteSlice

func (*Document) EnumTypeExtensionNameString

func (d *Document) EnumTypeExtensionNameString(ref int) string

func (*Document) EnumValueDefinitionDescriptionBytes

func (d *Document) EnumValueDefinitionDescriptionBytes(ref int) ByteSlice

func (*Document) EnumValueDefinitionDescriptionString

func (d *Document) EnumValueDefinitionDescriptionString(ref int) string

func (*Document) EnumValueDefinitionDirectiveByName

func (d *Document) EnumValueDefinitionDirectiveByName(definitionRef int, directiveName ByteSlice) (ref int, exists bool)

func (*Document) EnumValueDefinitionDirectives

func (d *Document) EnumValueDefinitionDirectives(ref int) (refs []int)

func (*Document) EnumValueDefinitionHasDirectives

func (d *Document) EnumValueDefinitionHasDirectives(ref int) bool

func (*Document) EnumValueDefinitionIsFirst

func (d *Document) EnumValueDefinitionIsFirst(ref int, ancestor Node) bool

func (*Document) EnumValueDefinitionIsLast

func (d *Document) EnumValueDefinitionIsLast(ref int, ancestor Node) bool

func (*Document) EnumValueDefinitionNameBytes

func (d *Document) EnumValueDefinitionNameBytes(ref int) ByteSlice

func (*Document) EnumValueDefinitionNameString

func (d *Document) EnumValueDefinitionNameString(ref int) string

func (*Document) EnumValueName

func (d *Document) EnumValueName(ref int) ByteSliceReference

func (*Document) EnumValueNameBytes

func (d *Document) EnumValueNameBytes(ref int) ByteSlice

func (*Document) EnumValueNameString

func (d *Document) EnumValueNameString(ref int) string

func (*Document) EnumValuesAreEqual

func (d *Document) EnumValuesAreEqual(left, right int) bool

func (*Document) ExtendEnumTypeDefinitionByEnumTypeExtension

func (d *Document) ExtendEnumTypeDefinitionByEnumTypeExtension(enumTypeDefinitionRef, enumTypeExtensionRef int)

func (*Document) ExtendInputObjectTypeDefinitionByInputObjectTypeExtension

func (d *Document) ExtendInputObjectTypeDefinitionByInputObjectTypeExtension(inputObjectTypeDefinitionRef, inputObjectTypeExtensionRef int)

func (*Document) ExtendInterfaceTypeDefinitionByInterfaceTypeExtension

func (d *Document) ExtendInterfaceTypeDefinitionByInterfaceTypeExtension(interfaceTypeDefinitionRef, interfaceTypeExtensionRef int)

func (*Document) ExtendObjectTypeDefinitionByObjectTypeExtension

func (d *Document) ExtendObjectTypeDefinitionByObjectTypeExtension(objectTypeDefinitionRef, objectTypeExtensionRef int)

func (*Document) ExtendScalarTypeDefinitionByScalarTypeExtension

func (d *Document) ExtendScalarTypeDefinitionByScalarTypeExtension(scalarTypeDefinitionRef, scalarTypeExtensionRef int)

func (*Document) ExtendUnionTypeDefinitionByUnionTypeExtension

func (d *Document) ExtendUnionTypeDefinitionByUnionTypeExtension(unionTypeDefinitionRef, unionTypeExtensionRef int)

func (*Document) FieldAliasBytes

func (d *Document) FieldAliasBytes(ref int) ByteSlice

func (*Document) FieldAliasIsDefined

func (d *Document) FieldAliasIsDefined(ref int) bool

func (*Document) FieldAliasOrNameBytes

func (d *Document) FieldAliasOrNameBytes(ref int) ByteSlice

func (*Document) FieldAliasOrNameString

func (d *Document) FieldAliasOrNameString(ref int) string

func (*Document) FieldAliasString

func (d *Document) FieldAliasString(ref int) string

func (*Document) FieldArgument

func (d *Document) FieldArgument(field int, name ByteSlice) (ref int, exists bool)

func (*Document) FieldArguments

func (d *Document) FieldArguments(ref int) []int

func (*Document) FieldDefinitionArgumentsDefinitions

func (d *Document) FieldDefinitionArgumentsDefinitions(ref int) []int

func (*Document) FieldDefinitionDescriptionBytes

func (d *Document) FieldDefinitionDescriptionBytes(ref int) ByteSlice

func (*Document) FieldDefinitionDescriptionString

func (d *Document) FieldDefinitionDescriptionString(ref int) string

func (*Document) FieldDefinitionDirectiveByName

func (d *Document) FieldDefinitionDirectiveByName(fieldDefinition int, directiveName ByteSlice) (ref int, exists bool)

func (*Document) FieldDefinitionDirectives

func (d *Document) FieldDefinitionDirectives(fieldDefinition int) (refs []int)

func (*Document) FieldDefinitionHasArgumentsDefinitions

func (d *Document) FieldDefinitionHasArgumentsDefinitions(ref int) bool

func (*Document) FieldDefinitionHasDirectives

func (d *Document) FieldDefinitionHasDirectives(ref int) bool

func (*Document) FieldDefinitionHasNamedDirective

func (d *Document) FieldDefinitionHasNamedDirective(fieldDefinition int, directiveName string) bool

func (*Document) FieldDefinitionIsFirst

func (d *Document) FieldDefinitionIsFirst(field int, ancestor Node) bool

func (*Document) FieldDefinitionIsLast

func (d *Document) FieldDefinitionIsLast(field int, ancestor Node) bool

func (*Document) FieldDefinitionNameBytes

func (d *Document) FieldDefinitionNameBytes(ref int) ByteSlice

func (*Document) FieldDefinitionNameString

func (d *Document) FieldDefinitionNameString(ref int) string

func (*Document) FieldDefinitionResolverTypeName

func (d *Document) FieldDefinitionResolverTypeName(enclosingType Node) ByteSlice

func (*Document) FieldDefinitionType

func (d *Document) FieldDefinitionType(ref int) int

func (*Document) FieldDefinitionTypeNode

func (d *Document) FieldDefinitionTypeNode(ref int) Node

func (*Document) FieldDefinitionsContainField

func (d *Document) FieldDefinitionsContainField(definitions []int, field ByteSlice) bool

func (*Document) FieldDirectives

func (d *Document) FieldDirectives(ref int) []int

func (*Document) FieldHasArguments

func (d *Document) FieldHasArguments(ref int) bool

func (*Document) FieldHasDirectives

func (d *Document) FieldHasDirectives(ref int) bool

func (*Document) FieldHasSelections

func (d *Document) FieldHasSelections(ref int) bool

func (*Document) FieldNameBytes

func (d *Document) FieldNameBytes(ref int) ByteSlice

func (*Document) FieldNameString

func (d *Document) FieldNameString(ref int) string

FieldNameString - returns fied name as a string value

func (*Document) FieldNameUnsafeString

func (d *Document) FieldNameUnsafeString(ref int) string

FieldNameUnsafeString - returns field name as a string which is unsafe pointer to document input content

func (*Document) FieldsAreEqualFlat

func (d *Document) FieldsAreEqualFlat(left, right int) bool

func (*Document) FieldsHaveSameShape

func (d *Document) FieldsHaveSameShape(left, right int) bool

func (*Document) FloatValueAsFloat32

func (d *Document) FloatValueAsFloat32(ref int) (out float32)

func (*Document) FloatValueIsNegative

func (d *Document) FloatValueIsNegative(ref int) bool

func (*Document) FloatValueRaw

func (d *Document) FloatValueRaw(ref int) ByteSlice

func (*Document) FloatValuesAreEqual

func (d *Document) FloatValuesAreEqual(left, right int) bool

func (*Document) FragmentDefinitionIsLastRootNode

func (d *Document) FragmentDefinitionIsLastRootNode(ref int) bool

func (*Document) FragmentDefinitionIsUsed

func (d *Document) FragmentDefinitionIsUsed(name ByteSlice) bool

func (*Document) FragmentDefinitionNameBytes

func (d *Document) FragmentDefinitionNameBytes(ref int) ByteSlice

func (*Document) FragmentDefinitionNameString

func (d *Document) FragmentDefinitionNameString(ref int) string

func (*Document) FragmentDefinitionRef

func (d *Document) FragmentDefinitionRef(byName ByteSlice) (ref int, exists bool)

func (*Document) FragmentDefinitionTypeName

func (d *Document) FragmentDefinitionTypeName(ref int) ByteSlice

func (*Document) FragmentSpreadNameBytes

func (d *Document) FragmentSpreadNameBytes(ref int) ByteSlice

func (*Document) FragmentSpreadNameString

func (d *Document) FragmentSpreadNameString(ref int) string

func (*Document) GenerateUnusedVariableDefinitionName

func (d *Document) GenerateUnusedVariableDefinitionName(operationDefinition int) []byte

func (*Document) HasSchemaDefinition

func (d *Document) HasSchemaDefinition() bool

func (*Document) ImportAndExtendEnumTypeDefinitionByEnumTypeExtension

func (d *Document) ImportAndExtendEnumTypeDefinitionByEnumTypeExtension(enumTypeExtensionRef int)

func (*Document) ImportAndExtendInputObjectTypeDefinitionByInputObjectTypeExtension

func (d *Document) ImportAndExtendInputObjectTypeDefinitionByInputObjectTypeExtension(inputObjectTypeExtensionRef int)

func (*Document) ImportAndExtendInterfaceTypeDefinitionByInterfaceTypeExtension

func (d *Document) ImportAndExtendInterfaceTypeDefinitionByInterfaceTypeExtension(interfaceTypeExtensionRef int)

func (*Document) ImportAndExtendObjectTypeDefinitionByObjectTypeExtension

func (d *Document) ImportAndExtendObjectTypeDefinitionByObjectTypeExtension(objectTypeExtensionRef int)

func (*Document) ImportAndExtendScalarTypeDefinitionByScalarTypeExtension

func (d *Document) ImportAndExtendScalarTypeDefinitionByScalarTypeExtension(scalarTypeExtensionRef int)

func (*Document) ImportAndExtendUnionTypeDefinitionByUnionTypeExtension

func (d *Document) ImportAndExtendUnionTypeDefinitionByUnionTypeExtension(unionTypeExtensionRef int)

func (*Document) ImportArgument

func (d *Document) ImportArgument(name string, value Value) (ref int)

func (*Document) ImportDescription

func (d *Document) ImportDescription(desc string) (description Description)

func (*Document) ImportDirective

func (d *Document) ImportDirective(name string, argRefs []int) (ref int)

func (*Document) ImportDirectiveDefinition

func (d *Document) ImportDirectiveDefinition(name, description string, argsRefs []int, locations []string) (ref int)

func (*Document) ImportEnumTypeDefinition

func (d *Document) ImportEnumTypeDefinition(name, description string, valueRefs []int) (ref int)

func (*Document) ImportEnumTypeDefinitionWithDirectives

func (d *Document) ImportEnumTypeDefinitionWithDirectives(name, description string, valueRefs []int, directiveRefs []int) (ref int)

func (*Document) ImportEnumValue

func (d *Document) ImportEnumValue(name ByteSlice) (ref int)

func (*Document) ImportEnumValueDefinition

func (d *Document) ImportEnumValueDefinition(value, description string, directiveRefs []int) (ref int)

func (*Document) ImportFieldDefinition

func (d *Document) ImportFieldDefinition(name, description string, typeRef int, argsRefs []int, directiveRefs []int) (ref int)

func (*Document) ImportFloatValue

func (d *Document) ImportFloatValue(raw ByteSlice, isNegative bool) (ref int)

func (*Document) ImportInputObjectTypeDefinition

func (d *Document) ImportInputObjectTypeDefinition(name, description string, argsRefs []int) (ref int)

func (*Document) ImportInputObjectTypeDefinitionWithDirectives

func (d *Document) ImportInputObjectTypeDefinitionWithDirectives(name, description string, argsRefs []int, directiveRefs []int) (ref int)

func (*Document) ImportInputValueDefinition

func (d *Document) ImportInputValueDefinition(name, description string, typeRef int, defaultValue DefaultValue) (ref int)

func (*Document) ImportIntValue

func (d *Document) ImportIntValue(raw ByteSlice, isNegative bool) (ref int)

func (*Document) ImportInterfaceTypeDefinition

func (d *Document) ImportInterfaceTypeDefinition(name, description string, fieldRefs []int) (ref int)

func (*Document) ImportInterfaceTypeDefinitionWithDirectives

func (d *Document) ImportInterfaceTypeDefinitionWithDirectives(name, description string, fieldRefs []int, iRefs []int, directiveRefs []int) (ref int)

func (*Document) ImportListValue

func (d *Document) ImportListValue(valueRefs []int) (ref int)

func (*Document) ImportObjectField

func (d *Document) ImportObjectField(name ByteSlice, value Value) (ref int)

func (*Document) ImportObjectTypeDefinition

func (d *Document) ImportObjectTypeDefinition(name, description string, fieldRefs []int, iRefs []int) (ref int)

func (*Document) ImportObjectTypeDefinitionWithDirectives

func (d *Document) ImportObjectTypeDefinitionWithDirectives(name, description string, fieldRefs []int, iRefs []int, directiveRefs []int) (ref int)

func (*Document) ImportObjectValue

func (d *Document) ImportObjectValue(fieldRefs []int) (ref int)

func (*Document) ImportRootNode

func (d *Document) ImportRootNode(ref int, kind NodeKind)

func (*Document) ImportRootOperationTypeDefinition

func (d *Document) ImportRootOperationTypeDefinition(name string, operationType OperationType) (ref int)

func (*Document) ImportRootOperationTypeDefinitions

func (d *Document) ImportRootOperationTypeDefinitions(queryTypeName, mutationTypeName, subscriptionTypeName string) (refs []int)

func (*Document) ImportScalarTypeDefinition

func (d *Document) ImportScalarTypeDefinition(name, description string) (ref int)

func (*Document) ImportScalarTypeDefinitionWithDirectives

func (d *Document) ImportScalarTypeDefinitionWithDirectives(name, description string, directiveRefs []int) (ref int)

func (*Document) ImportSchemaDefinition

func (d *Document) ImportSchemaDefinition(queryTypeName, mutationTypeName, subscriptionTypeName string)

func (*Document) ImportStringValue

func (d *Document) ImportStringValue(raw ByteSlice, isBlockString bool) (ref int)

func (*Document) ImportUnionTypeDefinition

func (d *Document) ImportUnionTypeDefinition(name, description string, typeRefs []int) (ref int)

func (*Document) ImportUnionTypeDefinitionWithDirectives

func (d *Document) ImportUnionTypeDefinitionWithDirectives(name, description string, typeRefs []int, directiveRefs []int) (ref int)

func (*Document) ImportVariableValue

func (d *Document) ImportVariableValue(name ByteSlice) (ref int)

func (*Document) ImportVariableValueArgument

func (d *Document) ImportVariableValueArgument(argName, variableName ByteSlice) (variableValueRef, argRef int)

func (*Document) InlineFragmentHasDirectives

func (d *Document) InlineFragmentHasDirectives(ref int) bool

func (*Document) InlineFragmentHasTypeCondition

func (d *Document) InlineFragmentHasTypeCondition(ref int) bool

func (*Document) InlineFragmentSelections

func (d *Document) InlineFragmentSelections(ref int) []int

func (*Document) InlineFragmentTypeConditionName

func (d *Document) InlineFragmentTypeConditionName(ref int) ByteSlice

func (*Document) InlineFragmentTypeConditionNameString

func (d *Document) InlineFragmentTypeConditionNameString(ref int) string

func (*Document) InputObjectTypeDefinitionDescriptionBytes

func (d *Document) InputObjectTypeDefinitionDescriptionBytes(ref int) ByteSlice

func (*Document) InputObjectTypeDefinitionDescriptionString

func (d *Document) InputObjectTypeDefinitionDescriptionString(ref int) string

func (*Document) InputObjectTypeDefinitionInputValueDefinitionByName

func (d *Document) InputObjectTypeDefinitionInputValueDefinitionByName(definition int, inputValueDefinitionName ByteSlice) int

func (*Document) InputObjectTypeDefinitionInputValueDefinitionDefaultValue

func (d *Document) InputObjectTypeDefinitionInputValueDefinitionDefaultValue(inputObjectTypeDefinitionName, inputValueDefinitionName string) Value

func (*Document) InputObjectTypeDefinitionInputValueDefinitionDefaultValueBool

func (d *Document) InputObjectTypeDefinitionInputValueDefinitionDefaultValueBool(inputObjectTypeDefinitionName, inputValueDefinitionName string) bool

func (*Document) InputObjectTypeDefinitionInputValueDefinitionDefaultValueFloat32

func (d *Document) InputObjectTypeDefinitionInputValueDefinitionDefaultValueFloat32(inputObjectTypeDefinitionName, inputValueDefinitionName string) float32

func (*Document) InputObjectTypeDefinitionInputValueDefinitionDefaultValueInt64

func (d *Document) InputObjectTypeDefinitionInputValueDefinitionDefaultValueInt64(inputObjectTypeDefinitionName, inputValueDefinitionName string) int64

func (*Document) InputObjectTypeDefinitionInputValueDefinitionDefaultValueString

func (d *Document) InputObjectTypeDefinitionInputValueDefinitionDefaultValueString(inputObjectTypeDefinitionName, inputValueDefinitionName string) string

func (*Document) InputObjectTypeDefinitionNameBytes

func (d *Document) InputObjectTypeDefinitionNameBytes(ref int) ByteSlice

func (*Document) InputObjectTypeDefinitionNameString

func (d *Document) InputObjectTypeDefinitionNameString(ref int) string

func (*Document) InputObjectTypeExtensionDescriptionBytes

func (d *Document) InputObjectTypeExtensionDescriptionBytes(ref int) ByteSlice

func (*Document) InputObjectTypeExtensionDescriptionString

func (d *Document) InputObjectTypeExtensionDescriptionString(ref int) string

func (*Document) InputObjectTypeExtensionHasDirectives

func (d *Document) InputObjectTypeExtensionHasDirectives(ref int) bool

func (*Document) InputObjectTypeExtensionHasInputFieldsDefinition

func (d *Document) InputObjectTypeExtensionHasInputFieldsDefinition(ref int) bool

func (*Document) InputObjectTypeExtensionNameBytes

func (d *Document) InputObjectTypeExtensionNameBytes(ref int) ByteSlice

func (*Document) InputObjectTypeExtensionNameString

func (d *Document) InputObjectTypeExtensionNameString(ref int) string

func (*Document) InputValueDefinitionArgumentIsOptional

func (d *Document) InputValueDefinitionArgumentIsOptional(ref int) bool

func (*Document) InputValueDefinitionDefaultValue

func (d *Document) InputValueDefinitionDefaultValue(ref int) Value

func (*Document) InputValueDefinitionDescriptionBytes

func (d *Document) InputValueDefinitionDescriptionBytes(ref int) ByteSlice

func (*Document) InputValueDefinitionDescriptionString

func (d *Document) InputValueDefinitionDescriptionString(ref int) string

func (*Document) InputValueDefinitionHasDefaultValue

func (d *Document) InputValueDefinitionHasDefaultValue(ref int) bool

func (*Document) InputValueDefinitionHasDirective

func (d *Document) InputValueDefinitionHasDirective(ref int, directiveName ByteSlice) bool

func (*Document) InputValueDefinitionIsFirst

func (d *Document) InputValueDefinitionIsFirst(inputValue int, ancestor Node) bool

func (*Document) InputValueDefinitionIsLast

func (d *Document) InputValueDefinitionIsLast(inputValue int, ancestor Node) bool

func (*Document) InputValueDefinitionNameBytes

func (d *Document) InputValueDefinitionNameBytes(ref int) ByteSlice

func (*Document) InputValueDefinitionNameString

func (d *Document) InputValueDefinitionNameString(ref int) string

func (*Document) InputValueDefinitionType

func (d *Document) InputValueDefinitionType(ref int) int

func (*Document) IntValue

func (d *Document) IntValue(ref int) IntValue

func (*Document) IntValueAsInt

func (d *Document) IntValueAsInt(ref int) (out int64)

func (*Document) IntValueAsInt32

func (d *Document) IntValueAsInt32(ref int) (out int32)

func (*Document) IntValueIsNegative

func (d *Document) IntValueIsNegative(ref int) bool

func (*Document) IntValueRaw

func (d *Document) IntValueRaw(ref int) ByteSlice

func (*Document) IntValuesAreEquals

func (d *Document) IntValuesAreEquals(left, right int) bool

func (*Document) InterfaceTypeDefinitionDescriptionBytes

func (d *Document) InterfaceTypeDefinitionDescriptionBytes(ref int) ByteSlice

func (*Document) InterfaceTypeDefinitionDescriptionString

func (d *Document) InterfaceTypeDefinitionDescriptionString(ref int) string

func (*Document) InterfaceTypeDefinitionImplementedByRootNodes

func (d *Document) InterfaceTypeDefinitionImplementedByRootNodes(ref int) []Node

InterfaceTypeDefinitionImplementedByRootNodes will return all RootNodes that implement the given interface type (by ref)

func (*Document) InterfaceTypeDefinitionImplementsInterface

func (d *Document) InterfaceTypeDefinitionImplementsInterface(definitionRef int, interfaceName ByteSlice) bool

func (*Document) InterfaceTypeDefinitionNameBytes

func (d *Document) InterfaceTypeDefinitionNameBytes(ref int) ByteSlice

func (*Document) InterfaceTypeDefinitionNameString

func (d *Document) InterfaceTypeDefinitionNameString(ref int) string

func (*Document) InterfaceTypeExtensionDescriptionBytes

func (d *Document) InterfaceTypeExtensionDescriptionBytes(ref int) ByteSlice

func (*Document) InterfaceTypeExtensionDescriptionString

func (d *Document) InterfaceTypeExtensionDescriptionString(ref int) string

func (*Document) InterfaceTypeExtensionHasDirectives

func (d *Document) InterfaceTypeExtensionHasDirectives(ref int) bool

func (*Document) InterfaceTypeExtensionHasFieldDefinitions

func (d *Document) InterfaceTypeExtensionHasFieldDefinitions(ref int) bool

func (*Document) InterfaceTypeExtensionNameBytes

func (d *Document) InterfaceTypeExtensionNameBytes(ref int) ByteSlice

func (*Document) InterfaceTypeExtensionNameString

func (d *Document) InterfaceTypeExtensionNameString(ref int) string

func (*Document) ListValuesAreEqual

func (d *Document) ListValuesAreEqual(left, right int) bool

func (*Document) NewEmptyRefs

func (d *Document) NewEmptyRefs() []int

func (*Document) NextRefIndex

func (d *Document) NextRefIndex() int

func (*Document) NodeByName

func (d *Document) NodeByName(name ByteSlice) (Node, bool)

func (*Document) NodeByNameStr

func (d *Document) NodeByNameStr(name string) (Node, bool)

func (*Document) NodeDirectiveLocation

func (d *Document) NodeDirectiveLocation(node Node) (location DirectiveLocation, err error)

func (*Document) NodeDirectives

func (d *Document) NodeDirectives(node Node) []int

func (*Document) NodeFieldDefinitionArgumentDefinitionByName

func (d *Document) NodeFieldDefinitionArgumentDefinitionByName(node Node, fieldName, argumentName ByteSlice) int

func (*Document) NodeFieldDefinitionArgumentsDefinitions

func (d *Document) NodeFieldDefinitionArgumentsDefinitions(node Node, fieldName ByteSlice) []int

func (*Document) NodeFieldDefinitionByName

func (d *Document) NodeFieldDefinitionByName(node Node, fieldName ByteSlice) (definition int, exists bool)

func (*Document) NodeFieldDefinitions

func (d *Document) NodeFieldDefinitions(node Node) []int

func (*Document) NodeFragmentIsAllowedOnInterfaceTypeDefinition

func (d *Document) NodeFragmentIsAllowedOnInterfaceTypeDefinition(fragmentNode, interfaceTypeNode Node) bool

func (*Document) NodeFragmentIsAllowedOnNode

func (d *Document) NodeFragmentIsAllowedOnNode(fragmentNode, onNode Node) bool

func (*Document) NodeFragmentIsAllowedOnObjectTypeDefinition

func (d *Document) NodeFragmentIsAllowedOnObjectTypeDefinition(fragmentNode, objectTypeNode Node) bool

func (*Document) NodeFragmentIsAllowedOnUnionTypeDefinition

func (d *Document) NodeFragmentIsAllowedOnUnionTypeDefinition(fragmentNode, unionTypeNode Node) bool

func (*Document) NodeHasDirectiveByNameString

func (d *Document) NodeHasDirectiveByNameString(node Node, directiveName string) bool

NodeHasDirectiveByNameString returns whether the given node has a directive with the given name as string.

func (*Document) NodeImplementsInterface

func (d *Document) NodeImplementsInterface(node Node, interfaceNode Node) bool

func (*Document) NodeInputFieldDefinitionByName

func (d *Document) NodeInputFieldDefinitionByName(node Node, name ByteSlice) (int, bool)

func (*Document) NodeInputFieldDefinitions

func (d *Document) NodeInputFieldDefinitions(node Node) []int

func (*Document) NodeInputValueDefinitions

func (d *Document) NodeInputValueDefinitions(node Node) []int

func (*Document) NodeInterfaceRefs

func (d *Document) NodeInterfaceRefs(node Node) (refs []int)

NodeInterfaceRefs returns the interfaces implemented by the given node (this is only applicable to object kinds). Returns nil if node kind is not an object kind.

func (*Document) NodeIsLastRootNode

func (d *Document) NodeIsLastRootNode(node Node) bool

func (*Document) NodeIsUnionMember

func (d *Document) NodeIsUnionMember(node Node, union Node) bool

func (*Document) NodeKindNameBytes

func (d *Document) NodeKindNameBytes(node Node) ByteSlice

func (*Document) NodeNameBytes

func (d *Document) NodeNameBytes(node Node) ByteSlice

func (*Document) NodeNameString

func (d *Document) NodeNameString(node Node) string

func (*Document) NodeNameUnsafeString

func (d *Document) NodeNameUnsafeString(node Node) string

TODO: we could use node name directly

func (*Document) NodeResolverTypeNameBytes

func (d *Document) NodeResolverTypeNameBytes(node Node, path Path) ByteSlice

NodeResolverTypeNameBytes returns lowercase query/mutation/subscription for Query/Mutation/Subscription for other type definitions it returns the default type name

func (*Document) NodeResolverTypeNameString

func (d *Document) NodeResolverTypeNameString(node Node, path Path) string

func (*Document) NodeUnionMemberRefs

func (d *Document) NodeUnionMemberRefs(node Node) (refs []int)

NodeUnionMemberRefs returns the union members of the given node (this is only applicable to union kinds). Returns nil if node kind is not an object kind.

func (*Document) NumOfOperationDefinitions

func (d *Document) NumOfOperationDefinitions() (n int)

func (*Document) ObjectField

func (d *Document) ObjectField(ref int) ObjectField

func (*Document) ObjectFieldNameBytes

func (d *Document) ObjectFieldNameBytes(ref int) ByteSlice

func (*Document) ObjectFieldNameString

func (d *Document) ObjectFieldNameString(ref int) string

func (*Document) ObjectFieldValue

func (d *Document) ObjectFieldValue(ref int) Value

func (*Document) ObjectFieldsAreEqual

func (d *Document) ObjectFieldsAreEqual(left, right int) bool

func (*Document) ObjectTypeDefinitionHasField

func (d *Document) ObjectTypeDefinitionHasField(ref int, fieldName []byte) bool

func (*Document) ObjectTypeDefinitionImplementsInterface

func (d *Document) ObjectTypeDefinitionImplementsInterface(definitionRef int, interfaceName ByteSlice) bool

func (*Document) ObjectTypeDefinitionNameBytes

func (d *Document) ObjectTypeDefinitionNameBytes(ref int) ByteSlice

func (*Document) ObjectTypeDefinitionNameRef

func (d *Document) ObjectTypeDefinitionNameRef(ref int) ByteSliceReference

func (*Document) ObjectTypeDefinitionNameString

func (d *Document) ObjectTypeDefinitionNameString(ref int) string

func (*Document) ObjectTypeDescriptionNameBytes

func (d *Document) ObjectTypeDescriptionNameBytes(ref int) ByteSlice

func (*Document) ObjectTypeDescriptionNameString

func (d *Document) ObjectTypeDescriptionNameString(ref int) string

func (*Document) ObjectTypeExtensionDescriptionNameBytes

func (d *Document) ObjectTypeExtensionDescriptionNameBytes(ref int) ByteSlice

func (*Document) ObjectTypeExtensionDescriptionNameString

func (d *Document) ObjectTypeExtensionDescriptionNameString(ref int) string

func (*Document) ObjectTypeExtensionHasDirectives

func (d *Document) ObjectTypeExtensionHasDirectives(ref int) bool

func (*Document) ObjectTypeExtensionHasFieldDefinitions

func (d *Document) ObjectTypeExtensionHasFieldDefinitions(ref int) bool

func (*Document) ObjectTypeExtensionNameBytes

func (d *Document) ObjectTypeExtensionNameBytes(ref int) ByteSlice

func (*Document) ObjectTypeExtensionNameString

func (d *Document) ObjectTypeExtensionNameString(ref int) string

func (*Document) ObjectValuesAreEqual

func (d *Document) ObjectValuesAreEqual(left, right int) bool

func (*Document) OperationDefinitionHasVariableDefinition

func (d *Document) OperationDefinitionHasVariableDefinition(ref int, variableName string) bool

func (*Document) OperationDefinitionNameBytes

func (d *Document) OperationDefinitionNameBytes(ref int) ByteSlice

func (*Document) OperationDefinitionNameString

func (d *Document) OperationDefinitionNameString(ref int) string

func (*Document) OperationNameExists

func (d *Document) OperationNameExists(operationName string) bool

func (*Document) PrintArgument

func (d *Document) PrintArgument(ref int, w io.Writer) error

func (*Document) PrintArguments

func (d *Document) PrintArguments(refs []int, w io.Writer) (err error)

func (*Document) PrintDescription

func (d *Document) PrintDescription(description Description, indent []byte, depth int, writer io.Writer) (err error)

nolint

func (*Document) PrintDirective

func (d *Document) PrintDirective(ref int, w io.Writer) error

func (*Document) PrintSelections

func (d *Document) PrintSelections(selections []int) (out string)

func (*Document) PrintType

func (d *Document) PrintType(ref int, w io.Writer) error

func (*Document) PrintTypeBytes

func (d *Document) PrintTypeBytes(ref int, buf []byte) ([]byte, error)

func (*Document) PrintValue

func (d *Document) PrintValue(value Value, w io.Writer) (err error)

nolint

func (*Document) PrintValueBytes

func (d *Document) PrintValueBytes(value Value, buf []byte) ([]byte, error)

func (*Document) RemoveDirectiveFromNode

func (d *Document) RemoveDirectiveFromNode(node Node, directiveRef int)

func (*Document) RemoveDirectivesFromNode

func (d *Document) RemoveDirectivesFromNode(node Node, directiveRefs []int)

func (*Document) RemoveFieldAlias

func (d *Document) RemoveFieldAlias(ref int)

func (*Document) RemoveFieldDefinitionsFromObjectTypeDefinition

func (d *Document) RemoveFieldDefinitionsFromObjectTypeDefinition(fieldDefinitionRefs []int, objectTypeDefinitionRef int)

func (*Document) RemoveFromSelectionSet

func (d *Document) RemoveFromSelectionSet(ref int, index int)

func (*Document) RemoveMergedTypeExtensions

func (d *Document) RemoveMergedTypeExtensions()

func (*Document) RemoveNodeFromNode

func (d *Document) RemoveNodeFromNode(remove, from Node)

func (*Document) RemoveNodeFromSelectionSet

func (d *Document) RemoveNodeFromSelectionSet(set int, node Node)

func (*Document) RemoveObjectTypeDefinition

func (d *Document) RemoveObjectTypeDefinition(name ByteSlice) bool

func (*Document) RemoveRootNode

func (d *Document) RemoveRootNode(node Node)

func (*Document) ReplaceFragmentSpread

func (d *Document) ReplaceFragmentSpread(selectionSet int, spreadRef int, replaceWithSelectionSet int)

ReplaceFragmentSpread replaces a fragment spread with a given selection set attention! this might lead to duplicate field problems because the same field with its unique field reference might be copied into the same selection set possible problems: changing directives or sub selections will affect both fields with the same id simple solution: run normalization deduplicate fields as part of the normalization flow this problem will be handled automatically just be careful in case you use this function outside of the normalization package

func (*Document) ReplaceFragmentSpreadWithInlineFragment

func (d *Document) ReplaceFragmentSpreadWithInlineFragment(selectionSet int, spreadRef int, replaceWithSelectionSet int, typeCondition TypeCondition)

ReplaceFragmentSpreadWithInlineFragment replaces a given fragment spread with a inline fragment attention! the same rules apply as for 'ReplaceFragmentSpread', look above!

func (*Document) ReplaceRootOperationTypeDefinition

func (d *Document) ReplaceRootOperationTypeDefinition(name string, operationType OperationType) (ref int, ok bool)

func (*Document) ReplaceRootOperationTypesOfSchemaDefinition

func (d *Document) ReplaceRootOperationTypesOfSchemaDefinition(schemaDefinitionRef int, queryTypeName, mutationTypeName, subscriptionTypeName string)

func (*Document) ReplaceSelectionOnSelectionSet

func (d *Document) ReplaceSelectionOnSelectionSet(ref, replace, with int)

func (*Document) Reset

func (d *Document) Reset()

func (*Document) ResolveListOrNameType

func (d *Document) ResolveListOrNameType(ref int) (typeRef int)

func (*Document) ResolveTypeNameBytes

func (d *Document) ResolveTypeNameBytes(ref int) ByteSlice

func (*Document) ResolveTypeNameString

func (d *Document) ResolveTypeNameString(ref int) string

func (*Document) ResolveUnderlyingType

func (d *Document) ResolveUnderlyingType(ref int) (typeRef int)

func (*Document) RootOperationTypeDefinitionIsFirstInSchemaDefinition

func (d *Document) RootOperationTypeDefinitionIsFirstInSchemaDefinition(ref int, ancestor Node) bool

func (*Document) RootOperationTypeDefinitionIsLastInSchemaDefinition

func (d *Document) RootOperationTypeDefinitionIsLastInSchemaDefinition(ref int, ancestor Node) bool

func (*Document) RootOperationTypeDefinitionNameString

func (d *Document) RootOperationTypeDefinitionNameString(ref int) string

func (*Document) ScalarTypeDefinitionDescriptionBytes

func (d *Document) ScalarTypeDefinitionDescriptionBytes(ref int) ByteSlice

func (*Document) ScalarTypeDefinitionDescriptionString

func (d *Document) ScalarTypeDefinitionDescriptionString(ref int) string

func (*Document) ScalarTypeDefinitionHasDirectives

func (d *Document) ScalarTypeDefinitionHasDirectives(ref int) bool

func (*Document) ScalarTypeDefinitionNameBytes

func (d *Document) ScalarTypeDefinitionNameBytes(ref int) ByteSlice

func (*Document) ScalarTypeDefinitionNameString

func (d *Document) ScalarTypeDefinitionNameString(ref int) string

func (*Document) ScalarTypeExtensionDescriptionBytes

func (d *Document) ScalarTypeExtensionDescriptionBytes(ref int) ByteSlice

func (*Document) ScalarTypeExtensionDescriptionString

func (d *Document) ScalarTypeExtensionDescriptionString(ref int) string

func (*Document) ScalarTypeExtensionHasDirectives

func (d *Document) ScalarTypeExtensionHasDirectives(ref int) bool

func (*Document) ScalarTypeExtensionNameBytes

func (d *Document) ScalarTypeExtensionNameBytes(ref int) ByteSlice

func (*Document) ScalarTypeExtensionNameString

func (d *Document) ScalarTypeExtensionNameString(ref int) string

func (*Document) SchemaDefinitionRef

func (d *Document) SchemaDefinitionRef() int

func (*Document) SelectionSetHasFieldSelectionWithNameOrAliasBytes

func (d *Document) SelectionSetHasFieldSelectionWithNameOrAliasBytes(set int, nameOrAlias []byte) bool

func (*Document) SelectionSetHasFieldSelectionWithNameOrAliasString

func (d *Document) SelectionSetHasFieldSelectionWithNameOrAliasString(set int, nameOrAlias string) bool

func (*Document) SelectionsAfter

func (d *Document) SelectionsAfter(selectionKind SelectionKind, selectionRef int, selectionSet Node) bool

func (*Document) SelectionsAfterField

func (d *Document) SelectionsAfterField(field int, selectionSet Node) bool

func (*Document) SelectionsAfterFragmentSpread

func (d *Document) SelectionsAfterFragmentSpread(fragmentSpread int, selectionSet Node) bool

func (*Document) SelectionsAfterInlineFragment

func (d *Document) SelectionsAfterInlineFragment(inlineFragment int, selectionSet Node) bool

func (*Document) SelectionsBeforeField

func (d *Document) SelectionsBeforeField(field int, selectionSet Node) bool

func (*Document) StringValue

func (d *Document) StringValue(ref int) StringValue

func (*Document) StringValueContentBytes

func (d *Document) StringValueContentBytes(ref int) ByteSlice

func (*Document) StringValueContentString

func (d *Document) StringValueContentString(ref int) string

func (*Document) StringValueIsBlockString

func (d *Document) StringValueIsBlockString(ref int) bool

func (*Document) StringValuesAreEquals

func (d *Document) StringValuesAreEquals(left, right int) bool

func (*Document) TypeDefinitionContainsImplementsInterface

func (d *Document) TypeDefinitionContainsImplementsInterface(typeName, interfaceName ByteSlice) bool

func (*Document) TypeIsEnum

func (d *Document) TypeIsEnum(ref int, definition *Document) bool

func (*Document) TypeIsList

func (d *Document) TypeIsList(ref int) bool

func (*Document) TypeIsNonNull

func (d *Document) TypeIsNonNull(ref int) bool

func (*Document) TypeIsScalar

func (d *Document) TypeIsScalar(ref int, definition *Document) bool

func (*Document) TypeNameBytes

func (d *Document) TypeNameBytes(ref int) ByteSlice

func (*Document) TypeNameString

func (d *Document) TypeNameString(ref int) string

func (*Document) TypesAreCompatibleDeep

func (d *Document) TypesAreCompatibleDeep(left int, right int) bool

func (*Document) TypesAreEqualDeep

func (d *Document) TypesAreEqualDeep(left int, right int) bool

func (*Document) UnionMemberTypeIsFirst

func (d *Document) UnionMemberTypeIsFirst(ref int, ancestor Node) bool

func (*Document) UnionMemberTypeIsLast

func (d *Document) UnionMemberTypeIsLast(ref int, ancestor Node) bool

func (*Document) UnionNodeIntersectsInterfaceNode

func (d *Document) UnionNodeIntersectsInterfaceNode(unionNode, interfaceNode Node) bool

func (*Document) UnionTypeDefinitionDescriptionBytes

func (d *Document) UnionTypeDefinitionDescriptionBytes(ref int) ByteSlice

func (*Document) UnionTypeDefinitionDescriptionString

func (d *Document) UnionTypeDefinitionDescriptionString(ref int) string

func (*Document) UnionTypeDefinitionHasDirectives

func (d *Document) UnionTypeDefinitionHasDirectives(ref int) bool

func (*Document) UnionTypeDefinitionHasField

func (d *Document) UnionTypeDefinitionHasField(ref int, fieldName []byte) bool

func (*Document) UnionTypeDefinitionNameBytes

func (d *Document) UnionTypeDefinitionNameBytes(ref int) ByteSlice

func (*Document) UnionTypeDefinitionNameString

func (d *Document) UnionTypeDefinitionNameString(ref int) string

func (*Document) UnionTypeExtensionDescriptionBytes

func (d *Document) UnionTypeExtensionDescriptionBytes(ref int) ByteSlice

func (*Document) UnionTypeExtensionDescriptionString

func (d *Document) UnionTypeExtensionDescriptionString(ref int) string

func (*Document) UnionTypeExtensionHasDirectives

func (d *Document) UnionTypeExtensionHasDirectives(ref int) bool

func (*Document) UnionTypeExtensionHasUnionMemberTypes

func (d *Document) UnionTypeExtensionHasUnionMemberTypes(ref int) bool

func (*Document) UnionTypeExtensionNameBytes

func (d *Document) UnionTypeExtensionNameBytes(ref int) ByteSlice

func (*Document) UnionTypeExtensionNameString

func (d *Document) UnionTypeExtensionNameString(ref int) string

func (*Document) UpdateRootNode

func (d *Document) UpdateRootNode(ref int, newNodeRef int, newNodeKind NodeKind)

func (*Document) Value

func (d *Document) Value(ref int) Value

func (*Document) ValueContainsVariable

func (d *Document) ValueContainsVariable(value Value) bool

func (*Document) ValueContentBytes

func (d *Document) ValueContentBytes(value Value) ByteSlice

func (*Document) ValueContentString

func (d *Document) ValueContentString(value Value) string

func (*Document) ValueToJSON

func (d *Document) ValueToJSON(value Value) ([]byte, error)

func (*Document) ValuesAreEqual

func (d *Document) ValuesAreEqual(left, right Value) bool

func (*Document) VariableDefinitionByNameAndOperation

func (d *Document) VariableDefinitionByNameAndOperation(operationDefinition int, name ByteSlice) (definition int, exists bool)

func (*Document) VariableDefinitionDefaultValue

func (d *Document) VariableDefinitionDefaultValue(ref int) Value

func (*Document) VariableDefinitionHasDefaultValue

func (d *Document) VariableDefinitionHasDefaultValue(ref int) bool

func (*Document) VariableDefinitionNameBytes

func (d *Document) VariableDefinitionNameBytes(ref int) ByteSlice

func (*Document) VariableDefinitionNameString

func (d *Document) VariableDefinitionNameString(ref int) string

func (*Document) VariableDefinitionsAfter

func (d *Document) VariableDefinitionsAfter(variableDefinition int) bool

func (*Document) VariableDefinitionsBefore

func (d *Document) VariableDefinitionsBefore(variableDefinition int) bool

func (*Document) VariableValueNameBytes

func (d *Document) VariableValueNameBytes(ref int) ByteSlice

func (*Document) VariableValueNameString

func (d *Document) VariableValueNameString(ref int) string

func (*Document) VariableValuesAreEqual

func (d *Document) VariableValuesAreEqual(left, right int) bool

type EnumTypeDefinition

type EnumTypeDefinition struct {
	Description             Description        // optional, describes enum
	EnumLiteral             position.Position  // enum
	Name                    ByteSliceReference // e.g. Direction
	HasDirectives           bool
	Directives              DirectiveList // optional, e.g. @foo
	HasEnumValuesDefinition bool
	EnumValuesDefinition    EnumValueDefinitionList // optional, e.g. { NORTH EAST }
}

EnumTypeDefinition example:

enum Direction {
 NORTH
 EAST
 SOUTH
 WEST
}

type EnumTypeExtension

type EnumTypeExtension struct {
	ExtendLiteral position.Position
	EnumTypeDefinition
}

type EnumValue

type EnumValue struct {
	Name ByteSliceReference // e.g. ORIGIN
}

EnumValue example: Name but not true or false or null

type EnumValueDefinition

type EnumValueDefinition struct {
	Description   Description        // optional, describes enum value
	EnumValue     ByteSliceReference // e.g. NORTH (Name but not true, false or null
	HasDirectives bool
	Directives    DirectiveList // optional, e.g. @foo
}

EnumValueDefinition example: "NORTH enum value" NORTH @foo

type EnumValueDefinitionList

type EnumValueDefinitionList struct {
	LBRACE position.Position // {
	Refs   []int             // EnumValueDefinition
	RBRACE position.Position // }
}

type Field

type Field struct {
	Alias         Alias              // optional, e.g. renamed:
	Name          ByteSliceReference // field name, e.g. id
	HasArguments  bool
	Arguments     ArgumentList // optional
	HasDirectives bool
	Directives    DirectiveList // optional
	SelectionSet  int           // optional
	HasSelections bool
	Position      position.Position
}

type FieldDefinition

type FieldDefinition struct {
	Description             Description        // optional e.g. "FieldDefinition is ..."
	Name                    ByteSliceReference // e.g. foo
	HasArgumentsDefinitions bool
	ArgumentsDefinition     InputValueDefinitionList // optional
	Colon                   position.Position        // :
	Type                    int                      // e.g. String
	HasDirectives           bool
	Directives              DirectiveList // e.g. @foo
}

type FieldDefinitionList

type FieldDefinitionList struct {
	LBRACE position.Position // {
	Refs   []int             // FieldDefinition
	RBRACE position.Position // }
}

type FloatValue

type FloatValue struct {
	Negative     bool               // indicates if the value is negative
	NegativeSign position.Position  // optional -
	Raw          ByteSliceReference // e.g. 13.37
}

FloatValue example: 13.37 / -13.37

type FragmentDefinition

type FragmentDefinition struct {
	FragmentLiteral position.Position  // fragment
	Name            ByteSliceReference // Name but not on, e.g. friendFields
	TypeCondition   TypeCondition      // e.g. on User
	Directives      DirectiveList      // optional, e.g. @foo
	SelectionSet    int                // e.g. { id }
	HasSelections   bool
}

FragmentDefinition example:

fragment friendFields on User {
 id
 name
 profilePic(size: 50)
}

type FragmentSpread

type FragmentSpread struct {
	Spread        position.Position  // ...
	FragmentName  ByteSliceReference // Name but not on, e.g. MyFragment
	HasDirectives bool
	Directives    DirectiveList // optional, e.g. @foo
}

FragmentSpread example: ...MyFragment

type Index

type Index struct {
	// QueryTypeName is the name of the query type on the schema Node
	// schema { query: Query }
	QueryTypeName ByteSlice
	// MutationTypeName is the name of the mutation type on the schema Node
	// schema { mutation: Mutation }
	MutationTypeName ByteSlice
	// SubscriptionTypeName is the name of the subscription type on the schema Node
	// schema { subscription: Subscription }
	SubscriptionTypeName ByteSlice

	// ReplacedFragmentSpreads is a list of references (slice indices) of all FragmentSpreads that got replaced during normalization.
	ReplacedFragmentSpreads []int
	// MergedTypeExtensions is a list of Nodes (Node kind + reference) that got merged during type extension merging.
	MergedTypeExtensions []Node
	// contains filtered or unexported fields
}

Index is a struct to easily look up objects in a document, e.g. find Nodes (type/interface/union definitions) by name

func (*Index) AddNodeBytes

func (i *Index) AddNodeBytes(name []byte, node Node)

func (*Index) AddNodeStr

func (i *Index) AddNodeStr(name string, node Node)

func (*Index) FirstNodeByNameBytes

func (i *Index) FirstNodeByNameBytes(name []byte) (Node, bool)

func (*Index) FirstNodeByNameStr

func (i *Index) FirstNodeByNameStr(name string) (Node, bool)

func (*Index) FirstNonExtensionNodeByNameBytes

func (i *Index) FirstNonExtensionNodeByNameBytes(name []byte) (Node, bool)

func (*Index) IsRootOperationTypeNameBytes

func (i *Index) IsRootOperationTypeNameBytes(typeName []byte) bool

func (*Index) IsRootOperationTypeNameString

func (i *Index) IsRootOperationTypeNameString(typeName string) bool

func (*Index) NodesByNameBytes

func (i *Index) NodesByNameBytes(name []byte) ([]Node, bool)

func (*Index) NodesByNameStr

func (i *Index) NodesByNameStr(name string) ([]Node, bool)

func (*Index) RemoveNodeByName

func (i *Index) RemoveNodeByName(name []byte)

func (*Index) ReplaceNode

func (i *Index) ReplaceNode(name []byte, oldNode Node, newNode Node)

func (*Index) Reset

func (i *Index) Reset()

Reset empties the Index

type InlineFragment

type InlineFragment struct {
	Spread        position.Position // ...
	TypeCondition TypeCondition     // on NamedType, e.g. on User
	HasDirectives bool
	Directives    DirectiveList // optional, e.g. @foo
	SelectionSet  int           // optional, e.g. { nextField }
	HasSelections bool
}

InlineFragment example:

... on User {
     friends {
       count
     }
   }

type Input

type Input struct {
	// RawBytes is the raw byte input
	RawBytes []byte
	// Length of RawBytes
	Length int
	// InputPosition is the current position in the RawBytes
	InputPosition int
	// TextPosition is the current position within the text (line and character information about the current Tokens)
	TextPosition position.Position
	// Variables are the json encoded variables of the operation
	Variables []byte
}

Input is a raw graphql document containing the raw input + meta data

func (*Input) AppendInputBytes

func (i *Input) AppendInputBytes(bytes []byte) (ref ByteSliceReference)

AppendInputBytes appends a byte slice to the current input and returns the ByteSliceReference

func (*Input) AppendInputString

func (i *Input) AppendInputString(input string) ByteSliceReference

AppendInputString appends a string to the current input and returns the ByteSliceReference

func (*Input) ByteSlice

func (i *Input) ByteSlice(reference ByteSliceReference) ByteSlice

ByteSlice returns the byte slice for a given byte ByteSliceReference

func (*Input) ByteSliceReferenceContentEquals

func (i *Input) ByteSliceReferenceContentEquals(left, right ByteSliceReference) bool

ByteSliceReferenceContentEquals compares the content of two byte slices and returns true if they are the same

func (*Input) ByteSliceString

func (i *Input) ByteSliceString(reference ByteSliceReference) string

ByteSliceString returns a string for a given ByteSliceReference

func (*Input) Reset

func (i *Input) Reset()

Reset empties the Input

func (*Input) ResetInputBytes

func (i *Input) ResetInputBytes(bytes []byte)

ResetInputBytes empties the input and sets it to bytes argument

func (*Input) ResetInputString

func (i *Input) ResetInputString(input string)

ResetInputString empties the input and sets it to input string.

type InputObjectTypeDefinition

type InputObjectTypeDefinition struct {
	Description              Description        // optional, describes the input type
	InputLiteral             position.Position  // input
	Name                     ByteSliceReference // name of the input type
	HasDirectives            bool
	Directives               DirectiveList // optional, e.g. @foo
	HasInputFieldsDefinition bool
	InputFieldsDefinition    InputValueDefinitionList // e.g. x:Float
}

type InputObjectTypeExtension

type InputObjectTypeExtension struct {
	ExtendLiteral position.Position
	InputObjectTypeDefinition
}

type InputValueDefinition

type InputValueDefinition struct {
	Description   Description        // optional, e.g. "input Foo is..."
	Name          ByteSliceReference // e.g. Foo
	Colon         position.Position  // :
	Type          int                // e.g. String
	DefaultValue  DefaultValue       // e.g. = "Bar"
	HasDirectives bool
	Directives    DirectiveList // e.g. @baz
}

type InputValueDefinitionList

type InputValueDefinitionList struct {
	LPAREN position.Position // (
	Refs   []int             // InputValueDefinition
	RPAREN position.Position // )
}

type IntValue

type IntValue struct {
	Negative     bool               // indicates if the value is negative
	NegativeSign position.Position  // optional -
	Raw          ByteSliceReference // e.g. 123
}

IntValue example: 123 / -123

type InterfaceTypeDefinition

type InterfaceTypeDefinition struct {
	Description          Description        // optional, describes the interface
	InterfaceLiteral     position.Position  // interface
	Name                 ByteSliceReference // e.g. NamedEntity
	ImplementsInterfaces TypeList           // e.g implements Bar & Baz
	HasDirectives        bool
	Directives           DirectiveList // optional, e.g. @foo
	HasFieldDefinitions  bool
	FieldsDefinition     FieldDefinitionList // optional, e.g. { name: String }
}

InterfaceTypeDefinition example:

interface NamedEntity {
	name: String
}

type InterfaceTypeExtension

type InterfaceTypeExtension struct {
	ExtendLiteral position.Position
	InterfaceTypeDefinition
}

type ListValue

type ListValue struct {
	LBRACK position.Position // [
	Refs   []int             // Value
	RBRACK position.Position // ]
}

type Node

type Node struct {
	Kind NodeKind
	Ref  int
}

func (*Node) IsExtensionKind

func (n *Node) IsExtensionKind() bool

func (Node) NameBytes

func (n Node) NameBytes(definition *Document) []byte

func (Node) NameString

func (n Node) NameString(definition *Document) string

type NodeKind

type NodeKind int
const (
	NodeKindUnknown NodeKind = 22 + iota
	NodeKindSchemaDefinition
	NodeKindSchemaExtension
	NodeKindObjectTypeDefinition
	NodeKindObjectTypeExtension
	NodeKindInterfaceTypeDefinition
	NodeKindInterfaceTypeExtension
	NodeKindUnionTypeDefinition
	NodeKindUnionTypeExtension
	NodeKindUnionMemberType
	NodeKindEnumTypeDefinition
	NodeKindEnumValueDefinition
	NodeKindEnumTypeExtension
	NodeKindInputObjectTypeDefinition
	NodeKindInputValueDefinition
	NodeKindInputObjectTypeExtension
	NodeKindScalarTypeDefinition
	NodeKindScalarTypeExtension
	NodeKindDirectiveDefinition
	NodeKindOperationDefinition
	NodeKindSelectionSet
	NodeKindField
	NodeKindFieldDefinition
	NodeKindFragmentSpread
	NodeKindInlineFragment
	NodeKindFragmentDefinition
	NodeKindArgument
	NodeKindDirective
	NodeKindVariableDefinition
)

func (NodeKind) String

func (i NodeKind) String() string

type ObjectField

type ObjectField struct {
	Name  ByteSliceReference // e.g. lon
	Colon position.Position  // :
	Value Value              // e.g. 12.43
}

ObjectField example: lon: 12.43

type ObjectTypeDefinition

type ObjectTypeDefinition struct {
	Description          Description        // optional, e.g. "type Foo is ..."
	TypeLiteral          position.Position  // type
	Name                 ByteSliceReference // e.g. Foo
	ImplementsInterfaces TypeList           // e.g implements Bar & Baz
	HasDirectives        bool
	Directives           DirectiveList // e.g. @foo
	HasFieldDefinitions  bool
	FieldsDefinition     FieldDefinitionList // { foo:Bar bar(baz:String) }
}

type ObjectTypeExtension

type ObjectTypeExtension struct {
	ExtendLiteral position.Position
	ObjectTypeDefinition
}

type ObjectValue

type ObjectValue struct {
	LBRACE position.Position
	Refs   []int // ObjectField
	RBRACE position.Position
}

ObjectValue example: { lon: 12.43, lat: -53.211 }

type OperationDefinition

type OperationDefinition struct {
	OperationType          OperationType      // one of query, mutation, subscription
	OperationTypeLiteral   position.Position  // position of the operation type literal, if present
	Name                   ByteSliceReference // optional, user defined name of the operation
	HasVariableDefinitions bool
	VariableDefinitions    VariableDefinitionList // optional, e.g. ($devicePicSize: Int)
	HasDirectives          bool
	Directives             DirectiveList // optional, e.g. @foo
	SelectionSet           int           // e.g. {field}
	HasSelections          bool
}

type OperationType

type OperationType int
const (
	OperationTypeUnknown OperationType = iota
	OperationTypeQuery
	OperationTypeMutation
	OperationTypeSubscription
)

func (OperationType) String

func (i OperationType) String() string

type Path

type Path []PathItem

func (Path) DotDelimitedString

func (p Path) DotDelimitedString() string

func (Path) Equals

func (p Path) Equals(another Path) bool

func (Path) String

func (p Path) String() string

type PathItem

type PathItem struct {
	Kind       PathKind
	ArrayIndex int
	FieldName  ByteSlice
}

func (PathItem) MarshalJSON

func (p PathItem) MarshalJSON() ([]byte, error)

func (*PathItem) UnmarshalJSON

func (p *PathItem) UnmarshalJSON(data []byte) error

type PathKind

type PathKind int
const (
	UnknownPathKind PathKind = iota
	ArrayIndex
	FieldName
)

func (PathKind) String

func (i PathKind) String() string

type Repeatable

type Repeatable struct {
	IsRepeatable bool
	Position     position.Position
}

type RootOperationTypeDefinition

type RootOperationTypeDefinition struct {
	OperationType OperationType     // one of query, mutation, subscription
	Colon         position.Position // :
	NamedType     Type              // e.g. Query
}

type RootOperationTypeDefinitionList

type RootOperationTypeDefinitionList struct {
	LBrace position.Position // {
	Refs   []int             // RootOperationTypeDefinition
	RBrace position.Position // }
}

type ScalarTypeDefinition

type ScalarTypeDefinition struct {
	Description   Description        // optional, describes the scalar
	ScalarLiteral position.Position  // scalar
	Name          ByteSliceReference // e.g. JSON
	HasDirectives bool
	Directives    DirectiveList // optional, e.g. @foo
}

ScalarTypeDefinition example: scalar JSON

type ScalarTypeExtension

type ScalarTypeExtension struct {
	ExtendLiteral position.Position
	ScalarTypeDefinition
}

type SchemaDefinition

type SchemaDefinition struct {
	SchemaLiteral                position.Position // schema
	HasDirectives                bool
	Directives                   DirectiveList                   // optional, e.g. @foo
	RootOperationTypeDefinitions RootOperationTypeDefinitionList // e.g. query: Query, mutation: Mutation, subscription: Subscription
}

func (*SchemaDefinition) AddRootOperationTypeDefinitionRefs

func (s *SchemaDefinition) AddRootOperationTypeDefinitionRefs(refs ...int)

type SchemaExtension

type SchemaExtension struct {
	ExtendLiteral position.Position
	SchemaDefinition
}

type Selection

type Selection struct {
	Kind SelectionKind // one of Field, FragmentSpread, InlineFragment
	Ref  int           // reference to the actual selection
}

type SelectionKind

type SelectionKind int
const (
	SelectionKindUnknown SelectionKind = 18 + iota
	SelectionKindField
	SelectionKindFragmentSpread
	SelectionKindInlineFragment
)

func (SelectionKind) String

func (i SelectionKind) String() string

type SelectionSet

type SelectionSet struct {
	LBrace        position.Position
	RBrace        position.Position
	SelectionRefs []int
}

type StringValue

type StringValue struct {
	BlockString bool               // """foo""" = blockString, "foo" string
	Content     ByteSliceReference // e.g. foo
}

StringValue example: "foo"

type Type

type Type struct {
	TypeKind TypeKind           // one of Named,List,NonNull
	Name     ByteSliceReference // e.g. String (only on NamedType)
	Open     position.Position  // [ (only on ListType)
	Close    position.Position  // ] (only on ListType)
	Bang     position.Position  // ! (only on NonNullType)
	OfType   int
}

type TypeCondition

type TypeCondition struct {
	On   position.Position // on
	Type int               // NamedType
}

TypeCondition example: on User

type TypeKind

type TypeKind int
const (
	TypeKindUnknown TypeKind = 14 + iota
	TypeKindNamed
	TypeKindList
	TypeKindNonNull
)

func (TypeKind) String

func (i TypeKind) String() string

type TypeList

type TypeList struct {
	Refs []int // Type
}

type UnionTypeDefinition

type UnionTypeDefinition struct {
	Description         Description        // optional, describes union
	UnionLiteral        position.Position  // union
	Name                ByteSliceReference // e.g. SearchResult
	HasDirectives       bool
	Directives          DirectiveList     // optional, e.g. @foo
	Equals              position.Position // =
	HasUnionMemberTypes bool
	UnionMemberTypes    TypeList // optional, e.g. Photo | Person
	HasFieldDefinitions bool
	FieldsDefinition    FieldDefinitionList // contains a single field: { __typename: String! }
}

UnionTypeDefinition example: union SearchResult = Photo | Person

type UnionTypeExtension

type UnionTypeExtension struct {
	ExtendLiteral position.Position
	UnionTypeDefinition
}

type Value

type Value struct {
	Kind ValueKind // e.g. 100 or "Bar"
	Ref  int
}

type ValueKind

type ValueKind int
const (
	ValueKindUnknown ValueKind = 4 + iota
	ValueKindString
	ValueKindBoolean
	ValueKindInteger
	ValueKindFloat
	ValueKindVariable
	ValueKindNull
	ValueKindList
	ValueKindObject
	ValueKindEnum
)

func (ValueKind) String

func (i ValueKind) String() string

type VariableDefinition

type VariableDefinition struct {
	VariableValue Value             // $ Name
	Colon         position.Position // :
	Type          int               // e.g. String
	DefaultValue  DefaultValue      // optional, e.g. = "Default"
	HasDirectives bool
	Directives    DirectiveList // optional, e.g. @foo
}

VariableDefinition example: $devicePicSize: Int = 100 @small

type VariableDefinitionList

type VariableDefinitionList struct {
	LPAREN position.Position // (
	Refs   []int             // VariableDefinition
	RPAREN position.Position // )
}

type VariableValue

type VariableValue struct {
	Dollar position.Position  // $
	Name   ByteSliceReference // e.g. devicePicSize
}

VariableValue example: $devicePicSize

Jump to

Keyboard shortcuts

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