Documentation ¶
Overview ¶
Package common adapted from https://github.com/graph-gophers/graphql-go/blob/master/internal/common.
Index ¶
- func ParseArgumentList(l *Lexer) types.ArgumentList
- func ParseDirectives(l *Lexer) types.DirectiveList
- func ParseInputValue(l *Lexer) *types.InputValueDefinition
- func ParseLiteral(l *Lexer, constOnly bool) types.Value
- func ParseType(l *Lexer) types.Type
- func ResolveType(t types.Type, resolver Resolver) (types.Type, *errors.QueryError)
- type Ident
- type Lexer
- func (l *Lexer) CatchScannerError(_ *scanner.Scanner, msg string)
- func (l *Lexer) CatchSyntaxError(f func()) (errRes *errors.QueryError)
- func (l *Lexer) ConsumeIdent() string
- func (l *Lexer) ConsumeIdentWithLoc() types.Ident
- func (l *Lexer) ConsumeKeyword(keyword string)
- func (l *Lexer) ConsumeLiteral() *types.PrimitiveValue
- func (l *Lexer) ConsumeToken(expected rune)
- func (l *Lexer) ConsumeWhitespace()
- func (l *Lexer) DescComment() string
- func (l *Lexer) Location() errors.Location
- func (l *Lexer) Peek() rune
- func (l *Lexer) SyntaxError(message string)
- type Resolver
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func ParseArgumentList ¶
func ParseArgumentList(l *Lexer) types.ArgumentList
ParseArgumentList returns an ArgumentList for a lexer instance
func ParseDirectives ¶
func ParseDirectives(l *Lexer) types.DirectiveList
ParseDirectives returns slice of DirectivesList
func ParseInputValue ¶
func ParseInputValue(l *Lexer) *types.InputValueDefinition
ParseInputValue returns a parsed input value definition of a lexer instance
func ParseLiteral ¶
ParseLiteral returns an interface value
func ResolveType ¶
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 Lexer ¶
type Lexer struct {
// contains filtered or unexported fields
}
Lexer fields
func (*Lexer) CatchScannerError ¶
CatchScannerError handles errors during message scanning
func (*Lexer) CatchSyntaxError ¶
func (l *Lexer) CatchSyntaxError(f func()) (errRes *errors.QueryError)
CatchSyntaxError provides error checking for Lexer instance
func (*Lexer) ConsumeIdentWithLoc ¶
ConsumeIdentWithLoc consumes indentifer and returns Ident with location
func (*Lexer) ConsumeKeyword ¶
ConsumeKeyword consumes keyword
func (*Lexer) ConsumeLiteral ¶
func (l *Lexer) ConsumeLiteral() *types.PrimitiveValue
ConsumeLiteral consumes literal and returns primitive value
func (*Lexer) ConsumeToken ¶
ConsumeToken consumes tokens
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) SyntaxError ¶
SyntaxError panics if inputer message has error