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 ¶
- Constants
- Variables
- func ByteSliceEquals(left ByteSliceReference, leftInput Input, right ByteSliceReference, ...) bool
- func FilterIntSliceByWhitelist(intSlice []int, whitelist []int) []int
- type Alias
- type Argument
- type ArgumentList
- type BooleanValue
- type ByteSlice
- type ByteSliceReference
- type ByteSliceReferences
- type ByteSlices
- type DefaultValue
- type Description
- type Directive
- type DirectiveDefinition
- type DirectiveList
- type DirectiveLocation
- type DirectiveLocationIterable
- type DirectiveLocations
- func (d *DirectiveLocations) Get(location DirectiveLocation) bool
- func (d *DirectiveLocations) Iterable() DirectiveLocationIterable
- func (d *DirectiveLocations) Set(location DirectiveLocation)
- func (d *DirectiveLocations) SetFromRaw(bytes []byte) error
- func (d *DirectiveLocations) Unset(location DirectiveLocation)
- type Document
- func (d *Document) AddArgument(argument Argument) (ref int)
- func (d *Document) AddArgumentToField(fieldRef, argRef int)
- func (d *Document) AddDirective(directive Directive) (ref int)
- func (d *Document) AddDirectiveDefinition(directiveDefinition DirectiveDefinition) (ref int)
- func (d *Document) AddDirectiveToNode(directiveRef int, node Node) bool
- func (d *Document) AddEnumTypeDefinition(definition EnumTypeDefinition) (ref int)
- func (d *Document) AddEnumValue(value EnumValue) (ref int)
- func (d *Document) AddEnumValueDefinition(inputValueDefinition EnumValueDefinition) (ref int)
- func (d *Document) AddField(field Field) Node
- func (d *Document) AddFieldDefinition(fieldDefinition FieldDefinition) (ref int)
- func (d *Document) AddFloatValue(value FloatValue) (ref int)
- func (d *Document) AddFragmentSpread(spread FragmentSpread) int
- func (d *Document) AddImportedVariableDefinitionToOperationDefinition(operationDefinition, variableDefinition int)
- func (d *Document) AddInlineFragment(fragment InlineFragment) int
- func (d *Document) AddInputObjectTypeDefinition(definition InputObjectTypeDefinition) (ref int)
- func (d *Document) AddInputValueDefinition(inputValueDefinition InputValueDefinition) (ref int)
- func (d *Document) AddIntValue(value IntValue) (ref int)
- func (d *Document) AddInterfaceTypeDefinition(definition InterfaceTypeDefinition) (ref int)
- func (d *Document) AddInterfaceTypeExtension(extension InterfaceTypeExtension) (ref int)
- func (d *Document) AddListType(ofType int) (ref int)
- func (d *Document) AddListTypeWithPosition(ofType int, open position.Position, close position.Position) (ref int)
- func (d *Document) AddListValue(value ListValue) (ref int)
- func (d *Document) AddNamedType(name []byte) (ref int)
- func (d *Document) AddNamedTypeByNameRef(nameRef ByteSliceReference) (ref int)
- func (d *Document) AddNonNullNamedType(name []byte) (ref int)
- func (d *Document) AddNonNullType(ofType int) (ref int)
- func (d *Document) AddNonNullTypeWithPosition(ofType int, bang position.Position) (ref int)
- func (d *Document) AddObjectField(field ObjectField) (ref int)
- func (d *Document) AddObjectTypeDefinition(definition ObjectTypeDefinition) (ref int)
- func (d *Document) AddObjectTypeDefinitionExtension(extension ObjectTypeExtension) (ref int)
- func (d *Document) AddObjectValue(value ObjectValue) (ref int)
- func (d *Document) AddOperationDefinitionToRootNodes(definition OperationDefinition) Node
- func (d *Document) AddRootNode(node Node)
- func (d *Document) AddRootOperationTypeDefinition(rootOperationTypeDefinition RootOperationTypeDefinition) (ref int)
- func (d *Document) AddScalarTypeDefinition(definition ScalarTypeDefinition) (ref int)
- func (d *Document) AddSchemaDefinition(schemaDefinition SchemaDefinition) (ref int)
- func (d *Document) AddSchemaDefinitionRootNode(schemaDefinition SchemaDefinition)
- func (d *Document) AddSelection(set int, selection Selection)
- func (d *Document) AddSelectionSet() Node
- func (d *Document) AddSelectionSetToDocument(set SelectionSet) int
- func (d *Document) AddSelectionToDocument(selection Selection) int
- func (d *Document) AddStringValue(value StringValue) (ref int)
- func (d *Document) AddType(t Type) (ref int)
- func (d *Document) AddUnionTypeDefinition(definition UnionTypeDefinition) (ref int)
- func (d *Document) AddValue(value Value) (ref int)
- func (d *Document) AddVariableDefinitionToOperationDefinition(operationDefinitionRef, variableValueRef, typeRef int)
- func (d *Document) AddVariableValue(value VariableValue) (ref int)
- func (d *Document) AddVariableValueArgument(argName, variableName []byte) (variableValueRef, argRef int)
- func (d *Document) AppendSelectionSet(ref int, appendRef int)
- func (d *Document) ArgumentNameBytes(ref int) ByteSlice
- func (d *Document) ArgumentNameString(ref int) string
- func (d *Document) ArgumentSetsAreEquals(left, right []int) bool
- func (d *Document) ArgumentValue(ref int) Value
- func (d *Document) ArgumentsAfter(ancestor Node, argument int) []int
- func (d *Document) ArgumentsAreEqual(left, right int) bool
- func (d *Document) ArgumentsBefore(ancestor Node, argument int) []int
- func (d *Document) BooleanValue(ref int) BooleanValue
- func (d *Document) BooleanValuesAreEqual(left, right int) bool
- func (d *Document) CopyAlias(alias Alias) Alias
- func (d *Document) CopyArgument(ref int) int
- func (d *Document) CopyArgumentList(list ArgumentList) ArgumentList
- func (d *Document) CopyDirective(ref int) int
- func (d *Document) CopyDirectiveList(list DirectiveList) DirectiveList
- func (d *Document) CopyEnumValue(ref int) int
- func (d *Document) CopyField(ref int) int
- func (d *Document) CopyFloatValue(ref int) int
- func (d *Document) CopyFragmentSpread(ref int) int
- func (d *Document) CopyInlineFragment(ref int) int
- func (d *Document) CopyIntValue(ref int) int
- func (d *Document) CopyListValue(ref int) int
- func (d *Document) CopyObjectField(ref int) int
- func (d *Document) CopyObjectValue(ref int) int
- func (d *Document) CopySelection(ref int) int
- func (d *Document) CopySelectionSet(ref int) int
- func (d *Document) CopyStringValue(ref int) int
- func (d *Document) CopyValue(ref int) int
- func (d *Document) CopyVariableValue(ref int) int
- func (d *Document) CreateRootOperationTypeDefinition(operationType OperationType, rootNodeRef int) (ref int)
- func (d *Document) DeleteRootNode(node Node)
- func (d *Document) DeleteRootNodes(nodes []Node)
- func (d *Document) DirectiveArgumentInputValueDefinition(directiveName ByteSlice, argumentName ByteSlice) int
- func (d *Document) DirectiveArgumentSet(ref int) []int
- func (d *Document) DirectiveArgumentValueByName(ref int, name ByteSlice) (Value, bool)
- func (d *Document) DirectiveDefinitionArgumentDefaultValueBool(directiveName, argumentName string) bool
- func (d *Document) DirectiveDefinitionArgumentDefaultValueFloat32(directiveName, argumentName string) float32
- func (d *Document) DirectiveDefinitionArgumentDefaultValueInt64(directiveName, argumentName string) int64
- func (d *Document) DirectiveDefinitionArgumentDefaultValueString(directiveName, argumentName string) string
- func (d *Document) DirectiveDefinitionByName(name string) (int, bool)
- func (d *Document) DirectiveDefinitionDescriptionBytes(ref int) ByteSlice
- func (d *Document) DirectiveDefinitionDescriptionString(ref int) string
- func (d *Document) DirectiveDefinitionNameBytes(ref int) ByteSlice
- func (d *Document) DirectiveDefinitionNameString(ref int) string
- func (d *Document) DirectiveIsAllowedOnNodeKind(directiveName string, kind NodeKind, operationType OperationType) bool
- func (d *Document) DirectiveIsFirst(directive int, ancestor Node) bool
- func (d *Document) DirectiveIsLast(directive int, ancestor Node) bool
- func (d *Document) DirectiveName(ref int) ByteSliceReference
- func (d *Document) DirectiveNameBytes(ref int) ByteSlice
- func (d *Document) DirectiveNameString(ref int) string
- func (d *Document) DirectiveSetsAreEqual(left, right []int) bool
- func (d *Document) DirectivesAreEqual(left, right int) bool
- func (d *Document) EmptySelectionSet(ref int)
- func (d *Document) EnumTypeDefinitionContainsEnumValue(enumTypeDef int, valueName ByteSlice) bool
- func (d *Document) EnumTypeDefinitionDescriptionBytes(ref int) ByteSlice
- func (d *Document) EnumTypeDefinitionDescriptionString(ref int) string
- func (d *Document) EnumTypeDefinitionHasDirectives(ref int) bool
- func (d *Document) EnumTypeDefinitionHasEnumValueDefinition(ref int) bool
- func (d *Document) EnumTypeDefinitionNameBytes(ref int) ByteSlice
- func (d *Document) EnumTypeDefinitionNameString(ref int) string
- func (d *Document) EnumTypeExtensionDescriptionBytes(ref int) ByteSlice
- func (d *Document) EnumTypeExtensionDescriptionString(ref int) string
- func (d *Document) EnumTypeExtensionHasDirectives(ref int) bool
- func (d *Document) EnumTypeExtensionHasEnumValueDefinition(ref int) bool
- func (d *Document) EnumTypeExtensionNameBytes(ref int) ByteSlice
- func (d *Document) EnumTypeExtensionNameString(ref int) string
- func (d *Document) EnumValueDefinitionDescriptionBytes(ref int) ByteSlice
- func (d *Document) EnumValueDefinitionDescriptionString(ref int) string
- func (d *Document) EnumValueDefinitionDirectiveByName(definitionRef int, directiveName ByteSlice) (ref int, exists bool)
- func (d *Document) EnumValueDefinitionDirectives(ref int) (refs []int)
- func (d *Document) EnumValueDefinitionHasDirectives(ref int) bool
- func (d *Document) EnumValueDefinitionIsFirst(ref int, ancestor Node) bool
- func (d *Document) EnumValueDefinitionIsLast(ref int, ancestor Node) bool
- func (d *Document) EnumValueDefinitionNameBytes(ref int) ByteSlice
- func (d *Document) EnumValueDefinitionNameString(ref int) string
- func (d *Document) EnumValueName(ref int) ByteSliceReference
- func (d *Document) EnumValueNameBytes(ref int) ByteSlice
- func (d *Document) EnumValueNameString(ref int) string
- func (d *Document) EnumValuesAreEqual(left, right int) bool
- func (d *Document) ExtendEnumTypeDefinitionByEnumTypeExtension(enumTypeDefinitionRef, enumTypeExtensionRef int)
- func (d *Document) ExtendInputObjectTypeDefinitionByInputObjectTypeExtension(inputObjectTypeDefinitionRef, inputObjectTypeExtensionRef int)
- func (d *Document) ExtendInterfaceTypeDefinitionByInterfaceTypeExtension(interfaceTypeDefinitionRef, interfaceTypeExtensionRef int)
- func (d *Document) ExtendObjectTypeDefinitionByObjectTypeExtension(objectTypeDefinitionRef, objectTypeExtensionRef int)
- func (d *Document) ExtendScalarTypeDefinitionByScalarTypeExtension(scalarTypeDefinitionRef, scalarTypeExtensionRef int)
- func (d *Document) ExtendUnionTypeDefinitionByUnionTypeExtension(unionTypeDefinitionRef, unionTypeExtensionRef int)
- func (d *Document) FieldAliasBytes(ref int) ByteSlice
- func (d *Document) FieldAliasIsDefined(ref int) bool
- func (d *Document) FieldAliasOrNameBytes(ref int) ByteSlice
- func (d *Document) FieldAliasOrNameString(ref int) string
- func (d *Document) FieldAliasString(ref int) string
- func (d *Document) FieldArgument(field int, name ByteSlice) (ref int, exists bool)
- func (d *Document) FieldArguments(ref int) []int
- func (d *Document) FieldDefinitionArgumentsDefinitions(ref int) []int
- func (d *Document) FieldDefinitionDescriptionBytes(ref int) ByteSlice
- func (d *Document) FieldDefinitionDescriptionString(ref int) string
- func (d *Document) FieldDefinitionDirectiveByName(fieldDefinition int, directiveName ByteSlice) (ref int, exists bool)
- func (d *Document) FieldDefinitionDirectives(fieldDefinition int) (refs []int)
- func (d *Document) FieldDefinitionHasArgumentsDefinitions(ref int) bool
- func (d *Document) FieldDefinitionHasDirectives(ref int) bool
- func (d *Document) FieldDefinitionHasNamedDirective(fieldDefinition int, directiveName string) bool
- func (d *Document) FieldDefinitionIsFirst(field int, ancestor Node) bool
- func (d *Document) FieldDefinitionIsLast(field int, ancestor Node) bool
- func (d *Document) FieldDefinitionNameBytes(ref int) ByteSlice
- func (d *Document) FieldDefinitionNameString(ref int) string
- func (d *Document) FieldDefinitionResolverTypeName(enclosingType Node) ByteSlice
- func (d *Document) FieldDefinitionType(ref int) int
- func (d *Document) FieldDefinitionTypeNode(ref int) Node
- func (d *Document) FieldDefinitionsContainField(definitions []int, field ByteSlice) bool
- func (d *Document) FieldDirectives(ref int) []int
- func (d *Document) FieldHasArguments(ref int) bool
- func (d *Document) FieldHasDirectives(ref int) bool
- func (d *Document) FieldHasSelections(ref int) bool
- func (d *Document) FieldNameBytes(ref int) ByteSlice
- func (d *Document) FieldNameString(ref int) string
- func (d *Document) FieldNameUnsafeString(ref int) string
- func (d *Document) FieldsAreEqualFlat(left, right int) bool
- func (d *Document) FieldsHaveSameShape(left, right int) bool
- func (d *Document) FloatValueAsFloat32(ref int) (out float32)
- func (d *Document) FloatValueIsNegative(ref int) bool
- func (d *Document) FloatValueRaw(ref int) ByteSlice
- func (d *Document) FloatValuesAreEqual(left, right int) bool
- func (d *Document) FragmentDefinitionIsLastRootNode(ref int) bool
- func (d *Document) FragmentDefinitionIsUsed(name ByteSlice) bool
- func (d *Document) FragmentDefinitionNameBytes(ref int) ByteSlice
- func (d *Document) FragmentDefinitionNameString(ref int) string
- func (d *Document) FragmentDefinitionRef(byName ByteSlice) (ref int, exists bool)
- func (d *Document) FragmentDefinitionTypeName(ref int) ByteSlice
- func (d *Document) FragmentSpreadNameBytes(ref int) ByteSlice
- func (d *Document) FragmentSpreadNameString(ref int) string
- func (d *Document) GenerateUnusedVariableDefinitionName(operationDefinition int) []byte
- func (d *Document) HasSchemaDefinition() bool
- func (d *Document) ImportAndExtendEnumTypeDefinitionByEnumTypeExtension(enumTypeExtensionRef int)
- func (d *Document) ImportAndExtendInputObjectTypeDefinitionByInputObjectTypeExtension(inputObjectTypeExtensionRef int)
- func (d *Document) ImportAndExtendInterfaceTypeDefinitionByInterfaceTypeExtension(interfaceTypeExtensionRef int)
- func (d *Document) ImportAndExtendObjectTypeDefinitionByObjectTypeExtension(objectTypeExtensionRef int)
- func (d *Document) ImportAndExtendScalarTypeDefinitionByScalarTypeExtension(scalarTypeExtensionRef int)
- func (d *Document) ImportAndExtendUnionTypeDefinitionByUnionTypeExtension(unionTypeExtensionRef int)
- func (d *Document) ImportArgument(name string, value Value) (ref int)
- func (d *Document) ImportDescription(desc string) (description Description)
- func (d *Document) ImportDirective(name string, argRefs []int) (ref int)
- func (d *Document) ImportDirectiveDefinition(name, description string, argsRefs []int, locations []string) (ref int)
- func (d *Document) ImportEnumTypeDefinition(name, description string, valueRefs []int) (ref int)
- func (d *Document) ImportEnumTypeDefinitionWithDirectives(name, description string, valueRefs []int, directiveRefs []int) (ref int)
- func (d *Document) ImportEnumValue(name ByteSlice) (ref int)
- func (d *Document) ImportEnumValueDefinition(value, description string, directiveRefs []int) (ref int)
- func (d *Document) ImportFieldDefinition(name, description string, typeRef int, argsRefs []int, directiveRefs []int) (ref int)
- func (d *Document) ImportFloatValue(raw ByteSlice, isNegative bool) (ref int)
- func (d *Document) ImportInputObjectTypeDefinition(name, description string, argsRefs []int) (ref int)
- func (d *Document) ImportInputObjectTypeDefinitionWithDirectives(name, description string, argsRefs []int, directiveRefs []int) (ref int)
- func (d *Document) ImportInputValueDefinition(name, description string, typeRef int, defaultValue DefaultValue) (ref int)
- func (d *Document) ImportIntValue(raw ByteSlice, isNegative bool) (ref int)
- func (d *Document) ImportInterfaceTypeDefinition(name, description string, fieldRefs []int) (ref int)
- func (d *Document) ImportInterfaceTypeDefinitionWithDirectives(name, description string, fieldRefs []int, iRefs []int, directiveRefs []int) (ref int)
- func (d *Document) ImportListValue(valueRefs []int) (ref int)
- func (d *Document) ImportObjectField(name ByteSlice, value Value) (ref int)
- func (d *Document) ImportObjectTypeDefinition(name, description string, fieldRefs []int, iRefs []int) (ref int)
- func (d *Document) ImportObjectTypeDefinitionWithDirectives(name, description string, fieldRefs []int, iRefs []int, directiveRefs []int) (ref int)
- func (d *Document) ImportObjectValue(fieldRefs []int) (ref int)
- func (d *Document) ImportRootNode(ref int, kind NodeKind)
- func (d *Document) ImportRootOperationTypeDefinition(name string, operationType OperationType) (ref int)
- func (d *Document) ImportRootOperationTypeDefinitions(queryTypeName, mutationTypeName, subscriptionTypeName string) (refs []int)
- func (d *Document) ImportScalarTypeDefinition(name, description string) (ref int)
- func (d *Document) ImportScalarTypeDefinitionWithDirectives(name, description string, directiveRefs []int) (ref int)
- func (d *Document) ImportSchemaDefinition(queryTypeName, mutationTypeName, subscriptionTypeName string)
- func (d *Document) ImportStringValue(raw ByteSlice, isBlockString bool) (ref int)
- func (d *Document) ImportUnionTypeDefinition(name, description string, typeRefs []int) (ref int)
- func (d *Document) ImportUnionTypeDefinitionWithDirectives(name, description string, typeRefs []int, directiveRefs []int) (ref int)
- func (d *Document) ImportVariableValue(name ByteSlice) (ref int)
- func (d *Document) ImportVariableValueArgument(argName, variableName ByteSlice) (variableValueRef, argRef int)
- func (d *Document) InlineFragmentHasDirectives(ref int) bool
- func (d *Document) InlineFragmentHasTypeCondition(ref int) bool
- func (d *Document) InlineFragmentSelections(ref int) []int
- func (d *Document) InlineFragmentTypeConditionName(ref int) ByteSlice
- func (d *Document) InlineFragmentTypeConditionNameString(ref int) string
- func (d *Document) InputObjectTypeDefinitionDescriptionBytes(ref int) ByteSlice
- func (d *Document) InputObjectTypeDefinitionDescriptionString(ref int) string
- func (d *Document) InputObjectTypeDefinitionInputValueDefinitionByName(definition int, inputValueDefinitionName ByteSlice) int
- func (d *Document) InputObjectTypeDefinitionInputValueDefinitionDefaultValue(inputObjectTypeDefinitionName, inputValueDefinitionName string) Value
- func (d *Document) InputObjectTypeDefinitionInputValueDefinitionDefaultValueBool(inputObjectTypeDefinitionName, inputValueDefinitionName string) bool
- func (d *Document) InputObjectTypeDefinitionInputValueDefinitionDefaultValueFloat32(inputObjectTypeDefinitionName, inputValueDefinitionName string) float32
- func (d *Document) InputObjectTypeDefinitionInputValueDefinitionDefaultValueInt64(inputObjectTypeDefinitionName, inputValueDefinitionName string) int64
- func (d *Document) InputObjectTypeDefinitionInputValueDefinitionDefaultValueString(inputObjectTypeDefinitionName, inputValueDefinitionName string) string
- func (d *Document) InputObjectTypeDefinitionNameBytes(ref int) ByteSlice
- func (d *Document) InputObjectTypeDefinitionNameString(ref int) string
- func (d *Document) InputObjectTypeExtensionDescriptionBytes(ref int) ByteSlice
- func (d *Document) InputObjectTypeExtensionDescriptionString(ref int) string
- func (d *Document) InputObjectTypeExtensionHasDirectives(ref int) bool
- func (d *Document) InputObjectTypeExtensionHasInputFieldsDefinition(ref int) bool
- func (d *Document) InputObjectTypeExtensionNameBytes(ref int) ByteSlice
- func (d *Document) InputObjectTypeExtensionNameString(ref int) string
- func (d *Document) InputValueDefinitionArgumentIsOptional(ref int) bool
- func (d *Document) InputValueDefinitionDefaultValue(ref int) Value
- func (d *Document) InputValueDefinitionDescriptionBytes(ref int) ByteSlice
- func (d *Document) InputValueDefinitionDescriptionString(ref int) string
- func (d *Document) InputValueDefinitionHasDefaultValue(ref int) bool
- func (d *Document) InputValueDefinitionHasDirective(ref int, directiveName ByteSlice) bool
- func (d *Document) InputValueDefinitionIsFirst(inputValue int, ancestor Node) bool
- func (d *Document) InputValueDefinitionIsLast(inputValue int, ancestor Node) bool
- func (d *Document) InputValueDefinitionNameBytes(ref int) ByteSlice
- func (d *Document) InputValueDefinitionNameString(ref int) string
- func (d *Document) InputValueDefinitionType(ref int) int
- func (d *Document) IntValue(ref int) IntValue
- func (d *Document) IntValueAsInt(ref int) (out int64)
- func (d *Document) IntValueAsInt32(ref int) (out int32)
- func (d *Document) IntValueIsNegative(ref int) bool
- func (d *Document) IntValueRaw(ref int) ByteSlice
- func (d *Document) IntValuesAreEquals(left, right int) bool
- func (d *Document) InterfaceTypeDefinitionDescriptionBytes(ref int) ByteSlice
- func (d *Document) InterfaceTypeDefinitionDescriptionString(ref int) string
- func (d *Document) InterfaceTypeDefinitionImplementedByRootNodes(ref int) []Node
- func (d *Document) InterfaceTypeDefinitionImplementsInterface(definitionRef int, interfaceName ByteSlice) bool
- func (d *Document) InterfaceTypeDefinitionNameBytes(ref int) ByteSlice
- func (d *Document) InterfaceTypeDefinitionNameString(ref int) string
- func (d *Document) InterfaceTypeExtensionDescriptionBytes(ref int) ByteSlice
- func (d *Document) InterfaceTypeExtensionDescriptionString(ref int) string
- func (d *Document) InterfaceTypeExtensionHasDirectives(ref int) bool
- func (d *Document) InterfaceTypeExtensionHasFieldDefinitions(ref int) bool
- func (d *Document) InterfaceTypeExtensionNameBytes(ref int) ByteSlice
- func (d *Document) InterfaceTypeExtensionNameString(ref int) string
- func (d *Document) ListValuesAreEqual(left, right int) bool
- func (d *Document) NewEmptyRefs() []int
- func (d *Document) NextRefIndex() int
- func (d *Document) NodeByName(name ByteSlice) (Node, bool)
- func (d *Document) NodeByNameStr(name string) (Node, bool)
- func (d *Document) NodeDirectiveLocation(node Node) (location DirectiveLocation, err error)
- func (d *Document) NodeDirectives(node Node) []int
- func (d *Document) NodeFieldDefinitionArgumentDefinitionByName(node Node, fieldName, argumentName ByteSlice) int
- func (d *Document) NodeFieldDefinitionArgumentsDefinitions(node Node, fieldName ByteSlice) []int
- func (d *Document) NodeFieldDefinitionByName(node Node, fieldName ByteSlice) (definition int, exists bool)
- func (d *Document) NodeFieldDefinitions(node Node) []int
- func (d *Document) NodeFragmentIsAllowedOnInterfaceTypeDefinition(fragmentNode, interfaceTypeNode Node) bool
- func (d *Document) NodeFragmentIsAllowedOnNode(fragmentNode, onNode Node) bool
- func (d *Document) NodeFragmentIsAllowedOnObjectTypeDefinition(fragmentNode, objectTypeNode Node) bool
- func (d *Document) NodeFragmentIsAllowedOnUnionTypeDefinition(fragmentNode, unionTypeNode Node) bool
- func (d *Document) NodeHasDirectiveByNameString(node Node, directiveName string) bool
- func (d *Document) NodeImplementsInterface(node Node, interfaceNode Node) bool
- func (d *Document) NodeInputFieldDefinitionByName(node Node, name ByteSlice) (int, bool)
- func (d *Document) NodeInputFieldDefinitions(node Node) []int
- func (d *Document) NodeInputValueDefinitions(node Node) []int
- func (d *Document) NodeInterfaceRefs(node Node) (refs []int)
- func (d *Document) NodeIsLastRootNode(node Node) bool
- func (d *Document) NodeIsUnionMember(node Node, union Node) bool
- func (d *Document) NodeKindNameBytes(node Node) ByteSlice
- func (d *Document) NodeNameBytes(node Node) ByteSlice
- func (d *Document) NodeNameString(node Node) string
- func (d *Document) NodeNameUnsafeString(node Node) string
- func (d *Document) NodeResolverTypeNameBytes(node Node, path Path) ByteSlice
- func (d *Document) NodeResolverTypeNameString(node Node, path Path) string
- func (d *Document) NodeUnionMemberRefs(node Node) (refs []int)
- func (d *Document) NumOfOperationDefinitions() (n int)
- func (d *Document) ObjectField(ref int) ObjectField
- func (d *Document) ObjectFieldNameBytes(ref int) ByteSlice
- func (d *Document) ObjectFieldNameString(ref int) string
- func (d *Document) ObjectFieldValue(ref int) Value
- func (d *Document) ObjectFieldsAreEqual(left, right int) bool
- func (d *Document) ObjectTypeDefinitionHasField(ref int, fieldName []byte) bool
- func (d *Document) ObjectTypeDefinitionImplementsInterface(definitionRef int, interfaceName ByteSlice) bool
- func (d *Document) ObjectTypeDefinitionNameBytes(ref int) ByteSlice
- func (d *Document) ObjectTypeDefinitionNameRef(ref int) ByteSliceReference
- func (d *Document) ObjectTypeDefinitionNameString(ref int) string
- func (d *Document) ObjectTypeDescriptionNameBytes(ref int) ByteSlice
- func (d *Document) ObjectTypeDescriptionNameString(ref int) string
- func (d *Document) ObjectTypeExtensionDescriptionNameBytes(ref int) ByteSlice
- func (d *Document) ObjectTypeExtensionDescriptionNameString(ref int) string
- func (d *Document) ObjectTypeExtensionHasDirectives(ref int) bool
- func (d *Document) ObjectTypeExtensionHasFieldDefinitions(ref int) bool
- func (d *Document) ObjectTypeExtensionNameBytes(ref int) ByteSlice
- func (d *Document) ObjectTypeExtensionNameString(ref int) string
- func (d *Document) ObjectValuesAreEqual(left, right int) bool
- func (d *Document) OperationDefinitionHasVariableDefinition(ref int, variableName string) bool
- func (d *Document) OperationDefinitionNameBytes(ref int) ByteSlice
- func (d *Document) OperationDefinitionNameString(ref int) string
- func (d *Document) OperationNameExists(operationName string) bool
- func (d *Document) PrintArgument(ref int, w io.Writer) error
- func (d *Document) PrintArguments(refs []int, w io.Writer) (err error)
- func (d *Document) PrintDescription(description Description, indent []byte, depth int, writer io.Writer) (err error)
- func (d *Document) PrintDirective(ref int, w io.Writer) error
- func (d *Document) PrintSelections(selections []int) (out string)
- func (d *Document) PrintType(ref int, w io.Writer) error
- func (d *Document) PrintTypeBytes(ref int, buf []byte) ([]byte, error)
- func (d *Document) PrintValue(value Value, w io.Writer) (err error)
- func (d *Document) PrintValueBytes(value Value, buf []byte) ([]byte, error)
- func (d *Document) RemoveDirectiveFromNode(node Node, directiveRef int)
- func (d *Document) RemoveDirectivesFromNode(node Node, directiveRefs []int)
- func (d *Document) RemoveFieldAlias(ref int)
- func (d *Document) RemoveFieldDefinitionsFromObjectTypeDefinition(fieldDefinitionRefs []int, objectTypeDefinitionRef int)
- func (d *Document) RemoveFromSelectionSet(ref int, index int)
- func (d *Document) RemoveMergedTypeExtensions()
- func (d *Document) RemoveNodeFromNode(remove, from Node)
- func (d *Document) RemoveNodeFromSelectionSet(set int, node Node)
- func (d *Document) RemoveObjectTypeDefinition(name ByteSlice) bool
- func (d *Document) RemoveRootNode(node Node)
- func (d *Document) ReplaceFragmentSpread(selectionSet int, spreadRef int, replaceWithSelectionSet int)
- func (d *Document) ReplaceFragmentSpreadWithInlineFragment(selectionSet int, spreadRef int, replaceWithSelectionSet int, ...)
- func (d *Document) ReplaceRootOperationTypeDefinition(name string, operationType OperationType) (ref int, ok bool)
- func (d *Document) ReplaceRootOperationTypesOfSchemaDefinition(schemaDefinitionRef int, ...)
- func (d *Document) ReplaceSelectionOnSelectionSet(ref, replace, with int)
- func (d *Document) Reset()
- func (d *Document) ResolveListOrNameType(ref int) (typeRef int)
- func (d *Document) ResolveTypeNameBytes(ref int) ByteSlice
- func (d *Document) ResolveTypeNameString(ref int) string
- func (d *Document) ResolveUnderlyingType(ref int) (typeRef int)
- func (d *Document) RootOperationTypeDefinitionIsFirstInSchemaDefinition(ref int, ancestor Node) bool
- func (d *Document) RootOperationTypeDefinitionIsLastInSchemaDefinition(ref int, ancestor Node) bool
- func (d *Document) RootOperationTypeDefinitionNameString(ref int) string
- func (d *Document) ScalarTypeDefinitionDescriptionBytes(ref int) ByteSlice
- func (d *Document) ScalarTypeDefinitionDescriptionString(ref int) string
- func (d *Document) ScalarTypeDefinitionHasDirectives(ref int) bool
- func (d *Document) ScalarTypeDefinitionNameBytes(ref int) ByteSlice
- func (d *Document) ScalarTypeDefinitionNameString(ref int) string
- func (d *Document) ScalarTypeExtensionDescriptionBytes(ref int) ByteSlice
- func (d *Document) ScalarTypeExtensionDescriptionString(ref int) string
- func (d *Document) ScalarTypeExtensionHasDirectives(ref int) bool
- func (d *Document) ScalarTypeExtensionNameBytes(ref int) ByteSlice
- func (d *Document) ScalarTypeExtensionNameString(ref int) string
- func (d *Document) SchemaDefinitionRef() int
- func (d *Document) SelectionSetHasFieldSelectionWithNameOrAliasBytes(set int, nameOrAlias []byte) bool
- func (d *Document) SelectionSetHasFieldSelectionWithNameOrAliasString(set int, nameOrAlias string) bool
- func (d *Document) SelectionsAfter(selectionKind SelectionKind, selectionRef int, selectionSet Node) bool
- func (d *Document) SelectionsAfterField(field int, selectionSet Node) bool
- func (d *Document) SelectionsAfterFragmentSpread(fragmentSpread int, selectionSet Node) bool
- func (d *Document) SelectionsAfterInlineFragment(inlineFragment int, selectionSet Node) bool
- func (d *Document) SelectionsBeforeField(field int, selectionSet Node) bool
- func (d *Document) StringValue(ref int) StringValue
- func (d *Document) StringValueContentBytes(ref int) ByteSlice
- func (d *Document) StringValueContentString(ref int) string
- func (d *Document) StringValueIsBlockString(ref int) bool
- func (d *Document) StringValuesAreEquals(left, right int) bool
- func (d *Document) TypeDefinitionContainsImplementsInterface(typeName, interfaceName ByteSlice) bool
- func (d *Document) TypeIsEnum(ref int, definition *Document) bool
- func (d *Document) TypeIsList(ref int) bool
- func (d *Document) TypeIsNonNull(ref int) bool
- func (d *Document) TypeIsScalar(ref int, definition *Document) bool
- func (d *Document) TypeNameBytes(ref int) ByteSlice
- func (d *Document) TypeNameString(ref int) string
- func (d *Document) TypesAreCompatibleDeep(left int, right int) bool
- func (d *Document) TypesAreEqualDeep(left int, right int) bool
- func (d *Document) UnionMemberTypeIsFirst(ref int, ancestor Node) bool
- func (d *Document) UnionMemberTypeIsLast(ref int, ancestor Node) bool
- func (d *Document) UnionNodeIntersectsInterfaceNode(unionNode, interfaceNode Node) bool
- func (d *Document) UnionTypeDefinitionDescriptionBytes(ref int) ByteSlice
- func (d *Document) UnionTypeDefinitionDescriptionString(ref int) string
- func (d *Document) UnionTypeDefinitionHasDirectives(ref int) bool
- func (d *Document) UnionTypeDefinitionHasField(ref int, fieldName []byte) bool
- func (d *Document) UnionTypeDefinitionNameBytes(ref int) ByteSlice
- func (d *Document) UnionTypeDefinitionNameString(ref int) string
- func (d *Document) UnionTypeExtensionDescriptionBytes(ref int) ByteSlice
- func (d *Document) UnionTypeExtensionDescriptionString(ref int) string
- func (d *Document) UnionTypeExtensionHasDirectives(ref int) bool
- func (d *Document) UnionTypeExtensionHasUnionMemberTypes(ref int) bool
- func (d *Document) UnionTypeExtensionNameBytes(ref int) ByteSlice
- func (d *Document) UnionTypeExtensionNameString(ref int) string
- func (d *Document) UpdateRootNode(ref int, newNodeRef int, newNodeKind NodeKind)
- func (d *Document) Value(ref int) Value
- func (d *Document) ValueContainsVariable(value Value) bool
- func (d *Document) ValueContentBytes(value Value) ByteSlice
- func (d *Document) ValueContentString(value Value) string
- func (d *Document) ValueToJSON(value Value) ([]byte, error)
- func (d *Document) ValuesAreEqual(left, right Value) bool
- func (d *Document) VariableDefinitionByNameAndOperation(operationDefinition int, name ByteSlice) (definition int, exists bool)
- func (d *Document) VariableDefinitionDefaultValue(ref int) Value
- func (d *Document) VariableDefinitionHasDefaultValue(ref int) bool
- func (d *Document) VariableDefinitionNameBytes(ref int) ByteSlice
- func (d *Document) VariableDefinitionNameString(ref int) string
- func (d *Document) VariableDefinitionsAfter(variableDefinition int) bool
- func (d *Document) VariableDefinitionsBefore(variableDefinition int) bool
- func (d *Document) VariableValueNameBytes(ref int) ByteSlice
- func (d *Document) VariableValueNameString(ref int) string
- func (d *Document) VariableValuesAreEqual(left, right int) bool
- type EnumTypeDefinition
- type EnumTypeExtension
- type EnumValue
- type EnumValueDefinition
- type EnumValueDefinitionList
- type Field
- type FieldDefinition
- type FieldDefinitionList
- type FloatValue
- type FragmentDefinition
- type FragmentSpread
- type Index
- func (i *Index) AddNodeBytes(name []byte, node Node)
- func (i *Index) AddNodeStr(name string, node Node)
- func (i *Index) FirstNodeByNameBytes(name []byte) (Node, bool)
- func (i *Index) FirstNodeByNameStr(name string) (Node, bool)
- func (i *Index) FirstNonExtensionNodeByNameBytes(name []byte) (Node, bool)
- func (i *Index) IsRootOperationTypeNameBytes(typeName []byte) bool
- func (i *Index) IsRootOperationTypeNameString(typeName string) bool
- func (i *Index) NodesByNameBytes(name []byte) ([]Node, bool)
- func (i *Index) NodesByNameStr(name string) ([]Node, bool)
- func (i *Index) RemoveNodeByName(name []byte)
- func (i *Index) ReplaceNode(name []byte, oldNode Node, newNode Node)
- func (i *Index) Reset()
- type InlineFragment
- type Input
- func (i *Input) AppendInputBytes(bytes []byte) (ref ByteSliceReference)
- func (i *Input) AppendInputString(input string) ByteSliceReference
- func (i *Input) ByteSlice(reference ByteSliceReference) ByteSlice
- func (i *Input) ByteSliceReferenceContentEquals(left, right ByteSliceReference) bool
- func (i *Input) ByteSliceString(reference ByteSliceReference) string
- func (i *Input) Reset()
- func (i *Input) ResetInputBytes(bytes []byte)
- func (i *Input) ResetInputString(input string)
- type InputObjectTypeDefinition
- type InputObjectTypeExtension
- type InputValueDefinition
- type InputValueDefinitionList
- type IntValue
- type InterfaceTypeDefinition
- type InterfaceTypeExtension
- type ListValue
- type Node
- type NodeKind
- type ObjectField
- type ObjectTypeDefinition
- type ObjectTypeExtension
- type ObjectValue
- type OperationDefinition
- type OperationType
- type Path
- type PathItem
- type PathKind
- type Repeatable
- type RootOperationTypeDefinition
- type RootOperationTypeDefinitionList
- type ScalarTypeDefinition
- type ScalarTypeExtension
- type SchemaDefinition
- type SchemaExtension
- type Selection
- type SelectionKind
- type SelectionSet
- type StringValue
- type Type
- type TypeCondition
- type TypeKind
- type TypeList
- type UnionTypeDefinition
- type UnionTypeExtension
- type Value
- type ValueKind
- type VariableDefinition
- type VariableDefinitionList
- type VariableValue
Examples ¶
Constants ¶
const InvalidRef = -1
Variables ¶
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
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 ByteSlice ¶
type ByteSlice []byte
ByteSlice is an alias for []byte
func (ByteSlice) MarshalJSON ¶
type ByteSliceReference ¶
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 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 ¶
func (d *DirectiveLocationIterable) Value() DirectiveLocation
type DirectiveLocations ¶
type DirectiveLocations struct {
// contains filtered or unexported fields
}
func (*DirectiveLocations) Get ¶
func (d *DirectiveLocations) Get(location DirectiveLocation) bool
func (*DirectiveLocations) Iterable ¶
func (d *DirectiveLocations) Iterable() DirectiveLocationIterable
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/wundergraph/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/wundergraph/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 (*Document) AddArgumentToField ¶
func (*Document) AddDirective ¶
func (*Document) AddDirectiveDefinition ¶
func (d *Document) AddDirectiveDefinition(directiveDefinition DirectiveDefinition) (ref int)
func (*Document) AddDirectiveToNode ¶
func (*Document) AddEnumTypeDefinition ¶
func (d *Document) AddEnumTypeDefinition(definition EnumTypeDefinition) (ref int)
func (*Document) AddEnumValue ¶
func (*Document) AddEnumValueDefinition ¶
func (d *Document) AddEnumValueDefinition(inputValueDefinition EnumValueDefinition) (ref int)
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 (*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 (*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 (*Document) AddListTypeWithPosition ¶
func (*Document) AddListValue ¶
func (*Document) AddNamedType ¶
func (*Document) AddNamedTypeByNameRef ¶
func (d *Document) AddNamedTypeByNameRef(nameRef ByteSliceReference) (ref int)
func (*Document) AddNonNullNamedType ¶
func (*Document) AddNonNullType ¶
func (*Document) AddNonNullTypeWithPosition ¶
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 (*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 (*Document) AddSelectionSet ¶
func (*Document) AddSelectionSetToDocument ¶
func (d *Document) AddSelectionSetToDocument(set SelectionSet) int
func (*Document) AddSelectionToDocument ¶
func (*Document) AddStringValue ¶
func (d *Document) AddStringValue(value StringValue) (ref int)
func (*Document) AddUnionTypeDefinition ¶
func (d *Document) AddUnionTypeDefinition(definition UnionTypeDefinition) (ref int)
func (*Document) AddVariableDefinitionToOperationDefinition ¶
func (*Document) AddVariableValue ¶
func (d *Document) AddVariableValue(value VariableValue) (ref int)
func (*Document) AddVariableValueArgument ¶
func (*Document) AppendSelectionSet ¶
func (*Document) ArgumentNameBytes ¶
func (*Document) ArgumentNameString ¶
func (*Document) ArgumentSetsAreEquals ¶
func (*Document) ArgumentValue ¶
func (*Document) ArgumentsAfter ¶
func (*Document) ArgumentsAreEqual ¶
func (*Document) ArgumentsBefore ¶
func (*Document) BooleanValue ¶
func (d *Document) BooleanValue(ref int) BooleanValue
func (*Document) BooleanValuesAreEqual ¶
func (*Document) CopyArgument ¶
func (*Document) CopyArgumentList ¶
func (d *Document) CopyArgumentList(list ArgumentList) ArgumentList
func (*Document) CopyDirective ¶
func (*Document) CopyDirectiveList ¶
func (d *Document) CopyDirectiveList(list DirectiveList) DirectiveList
func (*Document) CopyEnumValue ¶
func (*Document) CopyFloatValue ¶
func (*Document) CopyFragmentSpread ¶
func (*Document) CopyInlineFragment ¶
func (*Document) CopyIntValue ¶
func (*Document) CopyListValue ¶
func (*Document) CopyObjectField ¶
func (*Document) CopyObjectValue ¶
func (*Document) CopySelection ¶
func (*Document) CopySelectionSet ¶
func (*Document) CopyStringValue ¶
func (*Document) CopyVariableValue ¶
func (*Document) CreateRootOperationTypeDefinition ¶
func (d *Document) CreateRootOperationTypeDefinition(operationType OperationType, rootNodeRef int) (ref int)
func (*Document) DeleteRootNode ¶
func (*Document) DeleteRootNodes ¶
func (*Document) DirectiveArgumentInputValueDefinition ¶
func (*Document) DirectiveArgumentSet ¶
func (*Document) DirectiveArgumentValueByName ¶
func (*Document) DirectiveDefinitionArgumentDefaultValueBool ¶
func (*Document) DirectiveDefinitionArgumentDefaultValueFloat32 ¶
func (*Document) DirectiveDefinitionArgumentDefaultValueInt64 ¶
func (*Document) DirectiveDefinitionArgumentDefaultValueString ¶
func (*Document) DirectiveDefinitionByName ¶
func (*Document) DirectiveDefinitionDescriptionBytes ¶
func (*Document) DirectiveDefinitionDescriptionString ¶
func (*Document) DirectiveDefinitionNameBytes ¶
func (*Document) DirectiveDefinitionNameString ¶
func (*Document) DirectiveIsAllowedOnNodeKind ¶
func (d *Document) DirectiveIsAllowedOnNodeKind(directiveName string, kind NodeKind, operationType OperationType) bool
func (*Document) DirectiveIsFirst ¶
func (*Document) DirectiveIsLast ¶
func (*Document) DirectiveName ¶
func (d *Document) DirectiveName(ref int) ByteSliceReference
func (*Document) DirectiveNameBytes ¶
func (*Document) DirectiveNameString ¶
func (*Document) DirectiveSetsAreEqual ¶
func (*Document) DirectivesAreEqual ¶
func (*Document) EmptySelectionSet ¶
func (*Document) EnumTypeDefinitionContainsEnumValue ¶
func (*Document) EnumTypeDefinitionDescriptionBytes ¶
func (*Document) EnumTypeDefinitionDescriptionString ¶
func (*Document) EnumTypeDefinitionHasDirectives ¶
func (*Document) EnumTypeDefinitionHasEnumValueDefinition ¶
func (*Document) EnumTypeDefinitionNameBytes ¶
func (*Document) EnumTypeDefinitionNameString ¶
func (*Document) EnumTypeExtensionDescriptionBytes ¶
func (*Document) EnumTypeExtensionDescriptionString ¶
func (*Document) EnumTypeExtensionHasDirectives ¶
func (*Document) EnumTypeExtensionHasEnumValueDefinition ¶
func (*Document) EnumTypeExtensionNameBytes ¶
func (*Document) EnumTypeExtensionNameString ¶
func (*Document) EnumValueDefinitionDescriptionBytes ¶
func (*Document) EnumValueDefinitionDescriptionString ¶
func (*Document) EnumValueDefinitionDirectiveByName ¶
func (*Document) EnumValueDefinitionDirectives ¶
func (*Document) EnumValueDefinitionHasDirectives ¶
func (*Document) EnumValueDefinitionIsFirst ¶
func (*Document) EnumValueDefinitionIsLast ¶
func (*Document) EnumValueDefinitionNameBytes ¶
func (*Document) EnumValueDefinitionNameString ¶
func (*Document) EnumValueName ¶
func (d *Document) EnumValueName(ref int) ByteSliceReference
func (*Document) EnumValueNameBytes ¶
func (*Document) EnumValueNameString ¶
func (*Document) EnumValuesAreEqual ¶
func (*Document) ExtendEnumTypeDefinitionByEnumTypeExtension ¶
func (*Document) ExtendInputObjectTypeDefinitionByInputObjectTypeExtension ¶
func (*Document) ExtendInterfaceTypeDefinitionByInterfaceTypeExtension ¶
func (*Document) ExtendObjectTypeDefinitionByObjectTypeExtension ¶
func (*Document) ExtendScalarTypeDefinitionByScalarTypeExtension ¶
func (*Document) ExtendUnionTypeDefinitionByUnionTypeExtension ¶
func (*Document) FieldAliasBytes ¶
func (*Document) FieldAliasIsDefined ¶
func (*Document) FieldAliasOrNameBytes ¶
func (*Document) FieldAliasOrNameString ¶
func (*Document) FieldAliasString ¶
func (*Document) FieldArgument ¶
func (*Document) FieldArguments ¶
func (*Document) FieldDefinitionArgumentsDefinitions ¶
func (*Document) FieldDefinitionDescriptionBytes ¶
func (*Document) FieldDefinitionDescriptionString ¶
func (*Document) FieldDefinitionDirectiveByName ¶
func (*Document) FieldDefinitionDirectives ¶
func (*Document) FieldDefinitionHasArgumentsDefinitions ¶
func (*Document) FieldDefinitionHasDirectives ¶
func (*Document) FieldDefinitionHasNamedDirective ¶
func (*Document) FieldDefinitionIsFirst ¶
func (*Document) FieldDefinitionIsLast ¶
func (*Document) FieldDefinitionNameBytes ¶
func (*Document) FieldDefinitionNameString ¶
func (*Document) FieldDefinitionResolverTypeName ¶
func (*Document) FieldDefinitionType ¶
func (*Document) FieldDefinitionTypeNode ¶
func (*Document) FieldDefinitionsContainField ¶
func (*Document) FieldDirectives ¶
func (*Document) FieldHasArguments ¶
func (*Document) FieldHasDirectives ¶
func (*Document) FieldHasSelections ¶
func (*Document) FieldNameBytes ¶
func (*Document) FieldNameString ¶
FieldNameString - returns fied name as a string value
func (*Document) FieldNameUnsafeString ¶
FieldNameUnsafeString - returns field name as a string which is unsafe pointer to document input content
func (*Document) FieldsAreEqualFlat ¶
func (*Document) FieldsHaveSameShape ¶
func (*Document) FloatValueAsFloat32 ¶
func (*Document) FloatValueIsNegative ¶
func (*Document) FloatValueRaw ¶
func (*Document) FloatValuesAreEqual ¶
func (*Document) FragmentDefinitionIsLastRootNode ¶
func (*Document) FragmentDefinitionIsUsed ¶
func (*Document) FragmentDefinitionNameBytes ¶
func (*Document) FragmentDefinitionNameString ¶
func (*Document) FragmentDefinitionRef ¶
func (*Document) FragmentDefinitionTypeName ¶
func (*Document) FragmentSpreadNameBytes ¶
func (*Document) FragmentSpreadNameString ¶
func (*Document) GenerateUnusedVariableDefinitionName ¶
func (*Document) HasSchemaDefinition ¶
func (*Document) ImportAndExtendEnumTypeDefinitionByEnumTypeExtension ¶
func (*Document) ImportAndExtendInputObjectTypeDefinitionByInputObjectTypeExtension ¶
func (*Document) ImportAndExtendInterfaceTypeDefinitionByInterfaceTypeExtension ¶
func (*Document) ImportAndExtendObjectTypeDefinitionByObjectTypeExtension ¶
func (*Document) ImportAndExtendScalarTypeDefinitionByScalarTypeExtension ¶
func (*Document) ImportAndExtendUnionTypeDefinitionByUnionTypeExtension ¶
func (*Document) ImportArgument ¶
func (*Document) ImportDescription ¶
func (d *Document) ImportDescription(desc string) (description Description)
func (*Document) ImportDirective ¶
func (*Document) ImportDirectiveDefinition ¶
func (*Document) ImportEnumTypeDefinition ¶
func (*Document) ImportEnumTypeDefinitionWithDirectives ¶
func (*Document) ImportEnumValue ¶
func (*Document) ImportEnumValueDefinition ¶
func (*Document) ImportFieldDefinition ¶
func (*Document) ImportFloatValue ¶
func (*Document) ImportInputObjectTypeDefinition ¶
func (*Document) ImportInputObjectTypeDefinitionWithDirectives ¶
func (*Document) ImportInputValueDefinition ¶
func (d *Document) ImportInputValueDefinition(name, description string, typeRef int, defaultValue DefaultValue) (ref int)
func (*Document) ImportIntValue ¶
func (*Document) ImportInterfaceTypeDefinition ¶
func (*Document) ImportInterfaceTypeDefinitionWithDirectives ¶
func (*Document) ImportListValue ¶
func (*Document) ImportObjectField ¶
func (*Document) ImportObjectTypeDefinition ¶
func (*Document) ImportObjectTypeDefinitionWithDirectives ¶
func (*Document) ImportObjectValue ¶
func (*Document) ImportRootNode ¶
func (*Document) ImportRootOperationTypeDefinition ¶
func (d *Document) ImportRootOperationTypeDefinition(name string, operationType OperationType) (ref int)
func (*Document) ImportRootOperationTypeDefinitions ¶
func (*Document) ImportScalarTypeDefinition ¶
func (*Document) ImportScalarTypeDefinitionWithDirectives ¶
func (*Document) ImportSchemaDefinition ¶
func (*Document) ImportStringValue ¶
func (*Document) ImportUnionTypeDefinition ¶
func (*Document) ImportUnionTypeDefinitionWithDirectives ¶
func (*Document) ImportVariableValue ¶
func (*Document) ImportVariableValueArgument ¶
func (*Document) InlineFragmentHasDirectives ¶
func (*Document) InlineFragmentHasTypeCondition ¶
func (*Document) InlineFragmentSelections ¶
func (*Document) InlineFragmentTypeConditionName ¶
func (*Document) InlineFragmentTypeConditionNameString ¶
func (*Document) InputObjectTypeDefinitionDescriptionBytes ¶
func (*Document) InputObjectTypeDefinitionDescriptionString ¶
func (*Document) InputObjectTypeDefinitionInputValueDefinitionByName ¶
func (*Document) InputObjectTypeDefinitionInputValueDefinitionDefaultValue ¶
func (*Document) InputObjectTypeDefinitionInputValueDefinitionDefaultValueBool ¶
func (*Document) InputObjectTypeDefinitionInputValueDefinitionDefaultValueFloat32 ¶
func (*Document) InputObjectTypeDefinitionInputValueDefinitionDefaultValueInt64 ¶
func (*Document) InputObjectTypeDefinitionInputValueDefinitionDefaultValueString ¶
func (*Document) InputObjectTypeDefinitionNameBytes ¶
func (*Document) InputObjectTypeDefinitionNameString ¶
func (*Document) InputObjectTypeExtensionDescriptionBytes ¶
func (*Document) InputObjectTypeExtensionDescriptionString ¶
func (*Document) InputObjectTypeExtensionHasDirectives ¶
func (*Document) InputObjectTypeExtensionHasInputFieldsDefinition ¶
func (*Document) InputObjectTypeExtensionNameBytes ¶
func (*Document) InputObjectTypeExtensionNameString ¶
func (*Document) InputValueDefinitionArgumentIsOptional ¶
func (*Document) InputValueDefinitionDefaultValue ¶
func (*Document) InputValueDefinitionDescriptionBytes ¶
func (*Document) InputValueDefinitionDescriptionString ¶
func (*Document) InputValueDefinitionHasDefaultValue ¶
func (*Document) InputValueDefinitionHasDirective ¶
func (*Document) InputValueDefinitionIsFirst ¶
func (*Document) InputValueDefinitionIsLast ¶
func (*Document) InputValueDefinitionNameBytes ¶
func (*Document) InputValueDefinitionNameString ¶
func (*Document) InputValueDefinitionType ¶
func (*Document) IntValueAsInt ¶
func (*Document) IntValueAsInt32 ¶
func (*Document) IntValueIsNegative ¶
func (*Document) IntValueRaw ¶
func (*Document) IntValuesAreEquals ¶
func (*Document) InterfaceTypeDefinitionDescriptionBytes ¶
func (*Document) InterfaceTypeDefinitionDescriptionString ¶
func (*Document) InterfaceTypeDefinitionImplementedByRootNodes ¶
InterfaceTypeDefinitionImplementedByRootNodes will return all RootNodes that implement the given interface type (by ref)
func (*Document) InterfaceTypeDefinitionImplementsInterface ¶
func (*Document) InterfaceTypeDefinitionNameBytes ¶
func (*Document) InterfaceTypeDefinitionNameString ¶
func (*Document) InterfaceTypeExtensionDescriptionBytes ¶
func (*Document) InterfaceTypeExtensionDescriptionString ¶
func (*Document) InterfaceTypeExtensionHasDirectives ¶
func (*Document) InterfaceTypeExtensionHasFieldDefinitions ¶
func (*Document) InterfaceTypeExtensionNameBytes ¶
func (*Document) InterfaceTypeExtensionNameString ¶
func (*Document) ListValuesAreEqual ¶
func (*Document) NewEmptyRefs ¶
func (*Document) NextRefIndex ¶
func (*Document) NodeDirectiveLocation ¶
func (d *Document) NodeDirectiveLocation(node Node) (location DirectiveLocation, err error)
func (*Document) NodeDirectives ¶
func (*Document) NodeFieldDefinitionArgumentDefinitionByName ¶
func (*Document) NodeFieldDefinitionArgumentsDefinitions ¶
func (*Document) NodeFieldDefinitionByName ¶
func (*Document) NodeFieldDefinitions ¶
func (*Document) NodeFragmentIsAllowedOnInterfaceTypeDefinition ¶
func (*Document) NodeFragmentIsAllowedOnNode ¶
func (*Document) NodeFragmentIsAllowedOnObjectTypeDefinition ¶
func (*Document) NodeFragmentIsAllowedOnUnionTypeDefinition ¶
func (*Document) NodeHasDirectiveByNameString ¶
NodeHasDirectiveByNameString returns whether the given node has a directive with the given name as string.
func (*Document) NodeImplementsInterface ¶
func (*Document) NodeInputFieldDefinitionByName ¶
func (*Document) NodeInputFieldDefinitions ¶
func (*Document) NodeInputValueDefinitions ¶
func (*Document) NodeInterfaceRefs ¶
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 (*Document) NodeIsUnionMember ¶
func (*Document) NodeKindNameBytes ¶
func (*Document) NodeNameBytes ¶
func (*Document) NodeNameString ¶
func (*Document) NodeNameUnsafeString ¶
TODO: we could use node name directly
func (*Document) NodeResolverTypeNameBytes ¶
NodeResolverTypeNameBytes returns lowercase query/mutation/subscription for Query/Mutation/Subscription for other type definitions it returns the default type name
func (*Document) NodeResolverTypeNameString ¶
func (*Document) NodeUnionMemberRefs ¶
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 (*Document) ObjectField ¶
func (d *Document) ObjectField(ref int) ObjectField
func (*Document) ObjectFieldNameBytes ¶
func (*Document) ObjectFieldNameString ¶
func (*Document) ObjectFieldValue ¶
func (*Document) ObjectFieldsAreEqual ¶
func (*Document) ObjectTypeDefinitionHasField ¶
func (*Document) ObjectTypeDefinitionImplementsInterface ¶
func (*Document) ObjectTypeDefinitionNameBytes ¶
func (*Document) ObjectTypeDefinitionNameRef ¶
func (d *Document) ObjectTypeDefinitionNameRef(ref int) ByteSliceReference
func (*Document) ObjectTypeDefinitionNameString ¶
func (*Document) ObjectTypeDescriptionNameBytes ¶
func (*Document) ObjectTypeDescriptionNameString ¶
func (*Document) ObjectTypeExtensionDescriptionNameBytes ¶
func (*Document) ObjectTypeExtensionDescriptionNameString ¶
func (*Document) ObjectTypeExtensionHasDirectives ¶
func (*Document) ObjectTypeExtensionHasFieldDefinitions ¶
func (*Document) ObjectTypeExtensionNameBytes ¶
func (*Document) ObjectTypeExtensionNameString ¶
func (*Document) ObjectValuesAreEqual ¶
func (*Document) OperationDefinitionHasVariableDefinition ¶
func (*Document) OperationDefinitionNameBytes ¶
func (*Document) OperationDefinitionNameString ¶
func (*Document) OperationNameExists ¶
func (*Document) PrintArguments ¶
func (*Document) PrintDescription ¶
func (d *Document) PrintDescription(description Description, indent []byte, depth int, writer io.Writer) (err error)
nolint
func (*Document) PrintSelections ¶
func (*Document) PrintTypeBytes ¶
func (*Document) PrintValue ¶
nolint
func (*Document) PrintValueBytes ¶
func (*Document) RemoveDirectiveFromNode ¶
func (*Document) RemoveDirectivesFromNode ¶
func (*Document) RemoveFieldAlias ¶
func (*Document) RemoveFieldDefinitionsFromObjectTypeDefinition ¶
func (*Document) RemoveFromSelectionSet ¶
func (*Document) RemoveMergedTypeExtensions ¶
func (d *Document) RemoveMergedTypeExtensions()
func (*Document) RemoveNodeFromNode ¶
func (*Document) RemoveNodeFromSelectionSet ¶
func (*Document) RemoveObjectTypeDefinition ¶
func (*Document) RemoveRootNode ¶
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 (*Document) ReplaceSelectionOnSelectionSet ¶
func (*Document) ResolveListOrNameType ¶
func (*Document) ResolveTypeNameBytes ¶
func (*Document) ResolveTypeNameString ¶
func (*Document) ResolveUnderlyingType ¶
func (*Document) RootOperationTypeDefinitionIsFirstInSchemaDefinition ¶
func (*Document) RootOperationTypeDefinitionIsLastInSchemaDefinition ¶
func (*Document) RootOperationTypeDefinitionNameString ¶
func (*Document) ScalarTypeDefinitionDescriptionBytes ¶
func (*Document) ScalarTypeDefinitionDescriptionString ¶
func (*Document) ScalarTypeDefinitionHasDirectives ¶
func (*Document) ScalarTypeDefinitionNameBytes ¶
func (*Document) ScalarTypeDefinitionNameString ¶
func (*Document) ScalarTypeExtensionDescriptionBytes ¶
func (*Document) ScalarTypeExtensionDescriptionString ¶
func (*Document) ScalarTypeExtensionHasDirectives ¶
func (*Document) ScalarTypeExtensionNameBytes ¶
func (*Document) ScalarTypeExtensionNameString ¶
func (*Document) SchemaDefinitionRef ¶
func (*Document) SelectionSetHasFieldSelectionWithNameOrAliasBytes ¶
func (*Document) SelectionSetHasFieldSelectionWithNameOrAliasString ¶
func (*Document) SelectionsAfter ¶
func (d *Document) SelectionsAfter(selectionKind SelectionKind, selectionRef int, selectionSet Node) bool
func (*Document) SelectionsAfterField ¶
func (*Document) SelectionsAfterFragmentSpread ¶
func (*Document) SelectionsAfterInlineFragment ¶
func (*Document) SelectionsBeforeField ¶
func (*Document) StringValue ¶
func (d *Document) StringValue(ref int) StringValue
func (*Document) StringValueContentBytes ¶
func (*Document) StringValueContentString ¶
func (*Document) StringValueIsBlockString ¶
func (*Document) StringValuesAreEquals ¶
func (*Document) TypeDefinitionContainsImplementsInterface ¶
func (*Document) TypeIsList ¶
func (*Document) TypeIsNonNull ¶
func (*Document) TypeNameBytes ¶
func (*Document) TypeNameString ¶
func (*Document) TypesAreCompatibleDeep ¶
func (*Document) UnionMemberTypeIsFirst ¶
func (*Document) UnionMemberTypeIsLast ¶
func (*Document) UnionNodeIntersectsInterfaceNode ¶
func (*Document) UnionTypeDefinitionDescriptionBytes ¶
func (*Document) UnionTypeDefinitionDescriptionString ¶
func (*Document) UnionTypeDefinitionHasDirectives ¶
func (*Document) UnionTypeDefinitionHasField ¶
func (*Document) UnionTypeDefinitionNameBytes ¶
func (*Document) UnionTypeDefinitionNameString ¶
func (*Document) UnionTypeExtensionDescriptionBytes ¶
func (*Document) UnionTypeExtensionDescriptionString ¶
func (*Document) UnionTypeExtensionHasDirectives ¶
func (*Document) UnionTypeExtensionHasUnionMemberTypes ¶
func (*Document) UnionTypeExtensionNameBytes ¶
func (*Document) UnionTypeExtensionNameString ¶
func (*Document) UpdateRootNode ¶
func (*Document) ValueContainsVariable ¶
func (*Document) ValueContentBytes ¶
func (*Document) ValueContentString ¶
func (*Document) ValuesAreEqual ¶
func (*Document) VariableDefinitionByNameAndOperation ¶
func (*Document) VariableDefinitionDefaultValue ¶
func (*Document) VariableDefinitionHasDefaultValue ¶
func (*Document) VariableDefinitionNameBytes ¶
func (*Document) VariableDefinitionNameString ¶
func (*Document) VariableDefinitionsAfter ¶
func (*Document) VariableDefinitionsBefore ¶
func (*Document) VariableValueNameBytes ¶
func (*Document) VariableValueNameString ¶
func (*Document) VariableValuesAreEqual ¶
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 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 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 (*Index) AddNodeStr ¶
func (*Index) FirstNonExtensionNodeByNameBytes ¶
func (*Index) IsRootOperationTypeNameBytes ¶
func (*Index) IsRootOperationTypeNameString ¶
func (*Index) RemoveNodeByName ¶
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) ResetInputBytes ¶
ResetInputBytes empties the input and sets it to bytes argument
func (*Input) ResetInputString ¶
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 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 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 )
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 Repeatable ¶
type RootOperationTypeDefinition ¶
type RootOperationTypeDefinition struct { OperationType OperationType // one of query, mutation, subscription Colon position.Position // : NamedType Type // e.g. Query }
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 StringValue ¶
type StringValue struct { BlockString bool // """foo""" = blockString, "foo" string Content ByteSliceReference // e.g. foo }
StringValue example: "foo"
type TypeCondition ¶
TypeCondition example: on User
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 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 VariableValue ¶
type VariableValue struct { Dollar position.Position // $ Name ByteSliceReference // e.g. devicePicSize }
VariableValue example: $devicePicSize
Source Files ¶
- ast.go
- ast_argument.go
- ast_description.go
- ast_directive.go
- ast_directive_definition.go
- ast_enum_type_definition.go
- ast_enum_type_extension.go
- ast_enum_value_definition.go
- ast_field.go
- ast_field_alias.go
- ast_field_definition.go
- ast_fragment_definition.go
- ast_fragment_spread.go
- ast_inline_fragment.go
- ast_input_object_type_definition.go
- ast_input_object_type_extension.go
- ast_input_value_definition.go
- ast_interface_type_definition.go
- ast_interface_type_extension.go
- ast_node.go
- ast_node_kind.go
- ast_object_field.go
- ast_object_type_definition.go
- ast_object_type_extension.go
- ast_operation_definition.go
- ast_root_operation_type_definition.go
- ast_scalar_type_definition.go
- ast_scalar_type_extension.go
- ast_schema_definition.go
- ast_schema_extension.go
- ast_selection.go
- ast_string.go
- ast_type.go
- ast_union_type_definition.go
- ast_union_type_extension.go
- ast_val_boolean_value.go
- ast_val_enum_value.go
- ast_val_float_value.go
- ast_val_int_value.go
- ast_val_list_value.go
- ast_val_object_value.go
- ast_val_string_value.go
- ast_val_variable_value.go
- ast_value.go
- ast_variable_definition.go
- directive_location.go
- directive_location_string.go
- helpers.go
- index.go
- input.go
- path.go