parser

package
v0.0.0-...-e1cd2a4 Latest Latest
Warning

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

Go to latest
Published: Jan 25, 2023 License: MIT Imports: 11 Imported by: 2

Documentation

Index

Constants

View Source
const (
	Executable = 'E'
	TypeSystem = 'T'
)
View Source
const (
	FATAL int = 0
)

Error exit codes

Variables

View Source
var (

	// errors
	ErrNotCached error = errors.New("does not exist")
	ErrnotScalar error = errors.New("scalars are not permitted for FetchAST")
	ErrnoName    error = errors.New("No input name supplied to FetchAST")
)
View Source
var TypeResolveErr = errors.New("")

TypeResolveErr used only to categorise the error not to provided extra information.

Functions

func LoadASTcache

func LoadASTcache(c *Cache_)

Types

type Cache_

type Cache_ struct {
	sync.Mutex                   // Mutex protects whole cache. Channels protect individual cache entries.
	Cache      map[string]*entry // cache holds any AST accessed by its name such as types, statements in a doc.
	// contains filtered or unexported fields
}

func NewCache

func NewCache() *Cache_

NewCache allocates a structure to hold the cached data with access methods.

func (*Cache_) CacheClear

func (t *Cache_) CacheClear()

func (*Cache_) FetchAST

func (t *Cache_) FetchAST(name ast.NameValue_) (ast.GQLTypeProvider, error)

FetchAST is a concurrency safe access method to the cache. Used when resolving nested abstract types for the type being created. When all validation checks are satisfieid the type in question is added to the cache. If entry not found in the cache searches dynamodb table for the type SDL statement.

func (*Cache_) SetLogger

func (tc *Cache_) SetLogger(logr *log.Logger)

type Parser

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

func New

func New(l *lexer.Lexer) *Parser

func (*Parser) CheckSelfReference

func (p *Parser) CheckSelfReference(directive ast.NameValue_, x *ast.Directive_)

func (*Parser) CheckUnionMembers

func (p *Parser) CheckUnionMembers(x *ast.Union_)

func (*Parser) ClearCache

func (p *Parser) ClearCache()

func (*Parser) Getperror

func (p *Parser) Getperror() []error

func (*Parser) Loc

func (p *Parser) Loc() *ast.Loc_

func (*Parser) ParseDirective

func (p *Parser) ParseDirective(op string) ast.GQLTypeProvider

====================== Directive_ =============================== DirectiveDefinition

Descriptiono-pt directive @ Name ArgumentsDefinition-opt  on  DirectiveLocations

DirectiveLocations

| optDirectiveLocation

DirectiveLocations | DirectiveLocation DirectiveLocation

ExecutableDirectiveLocation
TypeSystemDirectiveLocation

func (*Parser) ParseDocument

func (p *Parser) ParseDocument(doc ...string) (api *ast.Document, errs []error)

func (*Parser) ParseEnumType

func (p *Parser) ParseEnumType(op string) ast.GQLTypeProvider

EnumTypeDefinition

Description-opt enum Name Directives-opt EnumValueDefinition-opt

EnumValuesDefinition

{EnumValueDefinition-list}

EnumValueDefinition

Description-opt EnumValue Directives-opt

func (*Parser) ParseInputValueType

func (p *Parser) ParseInputValueType(op string) ast.GQLTypeProvider

====================== Input =============================== InputObjectTypeDefinition

Description-opt	input	Name	DirectivesConst-opt	InputFieldsDefinition-opt

func (*Parser) ParseInterfaceType

func (p *Parser) ParseInterfaceType(op string) ast.GQLTypeProvider

====================== Interface =========================== InterfaceTypeDefinition

Description-opt	interface	Name	Directives-opt	FieldsDefinition-opt

func (*Parser) ParseObjectType

func (p *Parser) ParseObjectType(op string) ast.GQLTypeProvider

Description-opt TYPE Name ImplementsInterfaces-opt Directives-Const-opt FieldsDefinition-opt

		{FieldDefinition-list}
        FieldDefinition:
			Description-opt Name ArgumentsDefinition- opt : Type Directives-Con

func (*Parser) ParseResponse

func (p *Parser) ParseResponse() ast.InputValueProvider

ParseReponse - API for testing purposes only. Not part of normal processing.

func (*Parser) ParseScalar

func (p *Parser) ParseScalar(op string) ast.GQLTypeProvider

====================== Scalar_ =============================== InputObjectTypeDefinition

Description-opt	scalar	Name	DirectivesConst-opt

func (*Parser) ParseSchema

func (p *Parser) ParseSchema(op string) ast.GQLTypeProvider

SchemaDefinition

schemaDirectivesConstopt{RootOperationTypeDefinitionlist}

RootOperationTypeDefinition

OperationType : NamedType

func (*Parser) ParseStatement

func (p *Parser) ParseStatement() ast.GQLTypeProvider

parseStatement takes predefined parser routine and applies it to a valid statement

func (*Parser) ParseUnionType

func (p *Parser) ParseUnionType(op string) ast.GQLTypeProvider

====================== Union =============================== UnionTypeDefinition

Descriptionopt union Name  Directives-opt  UnionMemberTypes-opt

UnionMemberTypes

=|-opt	NamedType
UnionMemberTypes | NamedType

Jump to

Keyboard shortcuts

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