common

package
v1.5.0 Latest Latest
Warning

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

Go to latest
Published: Dec 19, 2022 License: BSD-2-Clause Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ParseArgumentList added in v1.1.0

func ParseArgumentList(l *Lexer) types.ArgumentList

func ParseDirectives

func ParseDirectives(l *Lexer) types.DirectiveList

func ParseInputValue

func ParseInputValue(l *Lexer) *types.InputValueDefinition

func ParseLiteral

func ParseLiteral(l *Lexer, constOnly bool) types.Value

func ParseType

func ParseType(l *Lexer) types.Type

func ResolveType

func ResolveType(t types.Type, resolver Resolver) (types.Type, *errors.QueryError)

ResolveType attempts to resolve a type's name against a resolving function. This function is used when one needs to check if a TypeName exists in the resolver (typically a Schema).

In the example below, ResolveType would be used to check if the resolving function returns a valid type for Dimension:

type Profile {
   picture(dimensions: Dimension): Url
}

ResolveType recursively unwraps List and NonNull types until a NamedType is reached.

Types

type Ident

type Ident struct {
	Name string
	Loc  errors.Location
}

type Lexer

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

func NewLexer

func NewLexer(s string, useStringDescriptions bool) *Lexer

func (*Lexer) CatchScannerError

func (l *Lexer) CatchScannerError(s *scanner.Scanner, msg string)

func (*Lexer) CatchSyntaxError

func (l *Lexer) CatchSyntaxError(f func()) (errRes *errors.QueryError)

func (*Lexer) ConsumeIdent

func (l *Lexer) ConsumeIdent() string

func (*Lexer) ConsumeIdentWithLoc

func (l *Lexer) ConsumeIdentWithLoc() types.Ident

func (*Lexer) ConsumeKeyword

func (l *Lexer) ConsumeKeyword(keyword string)

func (*Lexer) ConsumeLiteral

func (l *Lexer) ConsumeLiteral() *types.PrimitiveValue

func (*Lexer) ConsumeToken

func (l *Lexer) ConsumeToken(expected rune)

func (*Lexer) ConsumeWhitespace

func (l *Lexer) ConsumeWhitespace()

ConsumeWhitespace consumes whitespace and tokens equivalent to whitespace (e.g. commas and comments).

Consumed comment characters will build the description for the next type or field encountered. The description is available from `DescComment()`, and will be reset every time `ConsumeWhitespace()` is executed unless l.useStringDescriptions is set.

func (*Lexer) DescComment

func (l *Lexer) DescComment() string

func (*Lexer) Location

func (l *Lexer) Location() errors.Location

func (*Lexer) Peek

func (l *Lexer) Peek() rune

func (*Lexer) SyntaxError

func (l *Lexer) SyntaxError(message string)

type Resolver

type Resolver func(name string) types.Type

Jump to

Keyboard shortcuts

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