core

package
v2.5.31 Latest Latest
Warning

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

Go to latest
Published: Oct 30, 2025 License: MIT Imports: 9 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func OrList

func OrList(items ...string) string

Given [ A, B, C ] return 'A, B, or C'.

func QuotedOrList

func QuotedOrList(items ...string) string

Given [ A, B, C ] return '"A", "B", or "C"'.

func SuggestionList

func SuggestionList(input string, options []string) []string

Given an invalid input string and a list of valid options, returns a filtered list of valid options sorted based on their similarity with the input.

func Walk

func Walk(schema *ast.Schema, document *ast.QueryDocument, observers *Events)

Types

type AddErrFunc

type AddErrFunc func(options ...ErrorOption)

type ErrorOption

type ErrorOption func(err *gqlerror.Error)

func At

func At(position *ast.Position) ErrorOption

func Message

func Message(msg string, args ...interface{}) ErrorOption

func SuggestListQuoted

func SuggestListQuoted(prefix string, typed string, suggestions []string) ErrorOption

func SuggestListUnquoted

func SuggestListUnquoted(prefix string, typed string, suggestions []string) ErrorOption

func Suggestf

func Suggestf(suggestion string, args ...interface{}) ErrorOption

type Events

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

func (*Events) OnDirective

func (o *Events) OnDirective(f func(walker *Walker, directive *ast.Directive))

func (*Events) OnDirectiveList

func (o *Events) OnDirectiveList(f func(walker *Walker, directives []*ast.Directive))

func (*Events) OnField

func (o *Events) OnField(f func(walker *Walker, field *ast.Field))

func (*Events) OnFragment

func (o *Events) OnFragment(f func(walker *Walker, fragment *ast.FragmentDefinition))

func (*Events) OnFragmentSpread

func (o *Events) OnFragmentSpread(f func(walker *Walker, fragmentSpread *ast.FragmentSpread))

func (*Events) OnInlineFragment

func (o *Events) OnInlineFragment(f func(walker *Walker, inlineFragment *ast.InlineFragment))

func (*Events) OnOperation

func (o *Events) OnOperation(f func(walker *Walker, operation *ast.OperationDefinition))

func (*Events) OnValue

func (o *Events) OnValue(f func(walker *Walker, value *ast.Value))

func (*Events) OnVariable

func (o *Events) OnVariable(f func(walker *Walker, variable *ast.VariableDefinition))

type NameSorter added in v2.5.30

type NameSorter []Rule

NameSorter sorts Rules by name. usage: sort.Sort(core.NameSorter(specifiedRules))

func (NameSorter) Len added in v2.5.30

func (a NameSorter) Len() int

func (NameSorter) Less added in v2.5.30

func (a NameSorter) Less(i, j int) bool

func (NameSorter) Swap added in v2.5.30

func (a NameSorter) Swap(i, j int)

type Rule

type Rule struct {
	Name     string
	RuleFunc RuleFunc
}

type RuleFunc

type RuleFunc func(observers *Events, addError AddErrFunc)

type Walker

type Walker struct {
	Context   context.Context
	Observers *Events
	Schema    *ast.Schema
	Document  *ast.QueryDocument

	CurrentOperation *ast.OperationDefinition
	// contains filtered or unexported fields
}

Jump to

Keyboard shortcuts

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