gql

package
v0.7.0 Latest Latest
Warning

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

Go to latest
Published: Dec 8, 2016 License: Apache-2.0 Imports: 6 Imported by: 0

Documentation

Overview

Package gql is responsible for lexing and parsing a GraphQL query/mutation.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Parse

func Parse(input string) (gq *GraphQuery, mu *Mutation, rerr error)

Parse initializes and runs the lexer. It also constructs the GraphQuery subgraph from the lexed items.

Types

type FilterTree added in v0.7.0

type FilterTree struct {
	Op    string
	Func  *Function
	Child []*FilterTree
}

FilterTree is the result of parsing the filter directive.

type Function added in v0.7.0

type Function struct {
	Attr string
	Name string   // Specifies the name of the function.
	Args []string // Contains the arguments of the function.
}

Function holds the information about gql functions.

type GraphQuery

type GraphQuery struct {
	UID   uint64
	XID   string
	Attr  string
	Alias string
	Func  *Function

	Args     map[string]string
	Children []*GraphQuery
	Filter   *FilterTree
	// contains filtered or unexported fields
}

GraphQuery stores the parsed Query in a tree format. This gets converted to internally used query.SubGraph before processing the query.

func (*GraphQuery) DebugPrint added in v0.7.0

func (gq *GraphQuery) DebugPrint(prefix string)

DebugPrint is useful for debugging.

type Mutation

type Mutation struct {
	Set string
	Del string
}

Mutation stores the strings corresponding to set and delete operations.

Jump to

Keyboard shortcuts

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