Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func FreeNode

func FreeNode(n *Node)

Types

type Arg

type Arg struct {
	Name string
	Val  *Node
}

type Directive

type Directive struct {
	Name string
	Args []Arg
}

type Field

type Field struct {
	ID       int32
	ParentID int32
	Type     FieldType
	Name     string
	Alias    string
	Args     []Arg

	Directives []Directive
	Children   []int32
	// contains filtered or unexported fields
}

type FieldType

type FieldType int8
const (
	FieldUnion FieldType = iota + 1
	FieldMember
	FieldKeyword
)

func (FieldType) String

func (i FieldType) String() string

type Fragment

type Fragment struct {
	Name   string
	On     string
	Fields []Field
}

func ParseFragment

func ParseFragment(fragment string, fetchFrag func(name string) (string, error)) (
	Fragment, error)

type MType

type MType int8

MType identifies the type of lex items.

type Node

type Node struct {
	Type     ParserType
	Name     string
	Val      string
	Parent   *Node
	Children []*Node
}

func ParseArgValue

func ParseArgValue(argVal string, json bool) (*Node, error)

func (*Node) Free

func (n *Node) Free()

func (*Node) Reset

func (n *Node) Reset()

type Operation

type Operation struct {
	Type ParserType
	Name string
	Args []Arg

	Directives []Directive
	Fields     []Field
	// contains filtered or unexported fields
}

func Parse

func Parse(gql []byte, fetchFrag func(name string) (string, error)) (Operation, error)

type Parser

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

type ParserType

type ParserType int8
const (
	OpQuery ParserType
	OpMutate
	OpSub
	NodeStr
	NodeNum
	NodeBool
	NodeObj
	NodeList
	NodeVar
)

func (ParserType) String

func (i ParserType) String() string

type Pos

type Pos int

Pos represents a byte position in the original input text from which this template was parsed.

type Stack

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

func NewStack

func NewStack() *Stack

Create a new Stack

func (*Stack) Len

func (s *Stack) Len() int

Return the number of items in the Stack

func (*Stack) Peek

func (s *Stack) Peek() int32

View the top item on the Stack

func (*Stack) Pop

func (s *Stack) Pop() int32

Pop the top item of the Stack and return it

func (*Stack) Push

func (s *Stack) Push(value int32)

Push a value onto the top of the Stack