ast

package
v0.0.0-...-02cfa7b Latest Latest
Warning

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

Go to latest
Published: May 16, 2023 License: Apache-2.0 Imports: 5 Imported by: 2

Documentation

Overview

Package ast provides an AST of a GraphQL query or schema.

This package's API is UNSTABLE. New members may be added at any time, or renamed/moved.

Design notes: this package should consist of simple structs, and perhaps some marshaling code. No business logic, should just be storage of a parsed document

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Argument

type Argument struct {
	Name  string
	Value Value
}

func (*Argument) MarshalGraphQL

func (v *Argument) MarshalGraphQL(w io.Writer) error

type Arguments

type Arguments []*Argument

func (Arguments) ByName

func (v Arguments) ByName(name string) (argument *Argument, found bool)

ByName finds the argument with the given name, setting found to indicate if it was found

func (Arguments) MarshalGraphQL

func (v Arguments) MarshalGraphQL(w io.Writer) error

type ArgumentsDefinition

type ArgumentsDefinition []*InputValueDefinition

type ArrayValue

type ArrayValue struct {
	V []Value
}

func (ArrayValue) Representation

func (v ArrayValue) Representation() string

type BooleanValue

type BooleanValue struct {
	V bool
}

func (BooleanValue) Representation

func (v BooleanValue) Representation() string

type Directive

type Directive struct {
	Name      string
	Arguments Arguments
}

func (*Directive) MarshalGraphQL

func (v *Directive) MarshalGraphQL(w io.Writer) error

type Directives

type Directives []*Directive

func (Directives) ByName

func (v Directives) ByName(name string) (directive *Directive, found bool)

ByName finds the directive with the given name, setting found to indicate if it was found

func (Directives) MarshalGraphQL

func (v Directives) MarshalGraphQL(w io.Writer) error

type Document

type Document struct {
	OperationDefinitions []*OperationDefinition
	FragmentDefinitions  []*FragmentDefinition
	// contains filtered or unexported fields
}

func (*Document) AddFragmentDefinition

func (d *Document) AddFragmentDefinition(frag *FragmentDefinition)

func (*Document) AddOperationDefinition

func (d *Document) AddOperationDefinition(op *OperationDefinition)

func (*Document) LookupFragmentDefinition

func (d *Document) LookupFragmentDefinition(name string) *FragmentDefinition

func (*Document) LookupQueryOperation

func (d *Document) LookupQueryOperation(name string) *OperationDefinition

func (*Document) MarshalGraphQL

func (d *Document) MarshalGraphQL(w io.Writer) error

type EnumTypeDefinition

type EnumTypeDefinition struct {
	Description          string
	Name                 string
	Directives           Directives
	EnumValueDefinitions EnumValueDefinitions
}

type EnumValue

type EnumValue struct {
	V string
}

func (EnumValue) Representation

func (v EnumValue) Representation() string

type EnumValueDefinition

type EnumValueDefinition struct {
	Description string
	Value       string
	Directives  Directives
}

type EnumValueDefinitions

type EnumValueDefinitions []*EnumValueDefinition

type Field

type Field struct {
	Alias        string
	Name         string
	Row          int
	Col          int
	Arguments    Arguments
	Directives   Directives
	SelectionSet SelectionSet
}

func (*Field) MarshalGraphQL

func (v *Field) MarshalGraphQL(w io.Writer) error

type FieldDefinition

type FieldDefinition struct {
	Description         string
	Name                string
	ArgumentsDefinition ArgumentsDefinition
	Type                Type
	Directives          Directives
}

type FieldSelection

type FieldSelection struct {
	Field Field
}

func (*FieldSelection) MarshalGraphQL

func (v *FieldSelection) MarshalGraphQL(w io.Writer) error

type FieldsDefinition

type FieldsDefinition []*FieldDefinition

type FloatValue

type FloatValue struct {
	V float64
}

func (FloatValue) Representation

func (v FloatValue) Representation() string

type FragmentDefinition

type FragmentDefinition struct {
	Name         string
	OnType       string
	Directives   Directives
	SelectionSet SelectionSet
}

type FragmentSpreadSelection

type FragmentSpreadSelection struct {
	FragmentName string
	Directives   Directives
}

func (*FragmentSpreadSelection) MarshalGraphQL

func (v *FragmentSpreadSelection) MarshalGraphQL(w io.Writer) error

type GraphQLMarshaler

type GraphQLMarshaler interface {
	MarshalGraphQL(io.Writer) error
}

type ImplementsInterfaces

type ImplementsInterfaces []string

type InlineFragmentSelection

type InlineFragmentSelection struct {
	OnType       string
	Directives   Directives
	SelectionSet SelectionSet
}

func (*InlineFragmentSelection) MarshalGraphQL

func (v *InlineFragmentSelection) MarshalGraphQL(w io.Writer) error

type InputObjectTypeDefinition

type InputObjectTypeDefinition struct {
	Description                 string
	Name                        string
	Directives                  Directives
	InputObjectValueDefinitions InputObjectValueDefinitions
}

type InputObjectValueDefinitions

type InputObjectValueDefinitions []*InputValueDefinition

type InputValueDefinition

type InputValueDefinition struct {
	Description  string
	Name         string
	Type         Type
	DefaultValue Value
	Directives   Directives
}

type IntValue

type IntValue struct {
	V int64
}

func (IntValue) Representation

func (v IntValue) Representation() string

type InterfaceTypeDefinition

type InterfaceTypeDefinition struct {
	Description      string
	Name             string
	Directives       Directives
	FieldsDefinition FieldsDefinition
}

type Kind

type Kind int
const (
	KindSimple Kind = iota
	KindList
	KindNotNil
)

type ListType

type ListType struct {
	Of Type
}

func (*ListType) ContainedType

func (t *ListType) ContainedType() Type

func (*ListType) Kind

func (t *ListType) Kind() Kind

func (*ListType) Signature

func (t *ListType) Signature() string

type NilValue

type NilValue struct {
}

func (NilValue) Representation

func (NilValue) Representation() string

type NotNilType

type NotNilType struct {
	Of Type
}

func (*NotNilType) ContainedType

func (t *NotNilType) ContainedType() Type

func (*NotNilType) Kind

func (t *NotNilType) Kind() Kind

func (*NotNilType) Signature

func (t *NotNilType) Signature() string

type ObjectTypeDefinition

type ObjectTypeDefinition struct {
	Description          string
	Name                 string
	ImplementsInterfaces ImplementsInterfaces
	Directives           Directives
	FieldsDefinition     FieldsDefinition
}

type ObjectValue

type ObjectValue struct {
	V map[string]Value
}

func (ObjectValue) Representation

func (v ObjectValue) Representation() string

type OperationDefinition

type OperationDefinition struct {
	OperationType       OperationType
	Name                string
	VariableDefinitions VariableDefinitions
	Directives          Directives
	SelectionSet        SelectionSet
}

func (*OperationDefinition) MarshalGraphQL

func (o *OperationDefinition) MarshalGraphQL(w io.Writer) error

type OperationType

type OperationType string
const (
	OperationTypeQuery        OperationType = "query"
	OperationTypeMutation     OperationType = "mutation"
	OperationTypeSubscription OperationType = "subscription"
)

type ReferenceValue

type ReferenceValue struct {
	Name string
}

func (ReferenceValue) Representation

func (v ReferenceValue) Representation() string

type ScalarTypeDefinition

type ScalarTypeDefinition struct {
	Description string
	Name        string
	Directives  Directives
}

type Selection

type Selection interface {
	GraphQLMarshaler
}

type SelectionSet

type SelectionSet []Selection

func (SelectionSet) MarshalGraphQL

func (v SelectionSet) MarshalGraphQL(w io.Writer) error

type SimpleType

type SimpleType struct {
	Name string
}

func (*SimpleType) ContainedType

func (t *SimpleType) ContainedType() Type

func (*SimpleType) Kind

func (t *SimpleType) Kind() Kind

func (*SimpleType) Signature

func (t *SimpleType) Signature() string

type StringValue

type StringValue struct {
	V string
}

func (StringValue) Representation

func (v StringValue) Representation() string

type Type

type Type interface {
	Kind() Kind
	Signature() string
	ContainedType() Type
}

type UnionMembership

type UnionMembership []string

type UnionTypeDefinition

type UnionTypeDefinition struct {
	Description     string
	Name            string
	Directives      Directives
	UnionMembership UnionMembership
}

type Value

type Value interface {
	Representation() string
	// contains filtered or unexported methods
}

type VariableDefinition

type VariableDefinition struct {
	VariableName string
	Type         Type
	DefaultValue Value
	Directives   Directives
}

func (*VariableDefinition) MarshalGraphQL

func (v *VariableDefinition) MarshalGraphQL(w io.Writer) error

type VariableDefinitions

type VariableDefinitions []*VariableDefinition

func (VariableDefinitions) MarshalGraphQL

func (v VariableDefinitions) MarshalGraphQL(w io.Writer) error

Jump to

Keyboard shortcuts

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