ast

package
v0.0.0-...-ecb3d1e 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: 0

Documentation

Index

Constants

View Source
const (
	OPERATION byte = iota
	FRAGMENT
)
View Source
const (
	TableName string = "GraphQL2"
)

Variables

This section is empty.

Functions

func DBFetch

func DBFetch(name sdl.NameValue_) (string, error)

func SetDefaultDoc

func SetDefaultDoc(doc string)

func SetDocument

func SetDocument(doc string)

Types

type Document

type Document struct {
	Statements []*Statement
}

func (Document) String

func (d Document) String() string

type Field

type Field struct {
	//Type  int // Fragment, InlineFragment, Field
	Alias sdl.Name_
	Name  sdl.Name_ // must have atleast a name - all else can be empty
	//
	SDLRootAST sdl.GQLTypeProvider // Parent type, populated during checkField. Could be sdl.Object_, sdl.Interface, sdl.Union_(??)
	SDLfld     *sdl.Field_         // matching field in sdl object. populated during checkField
	Path       string              // path to field in statement
	//
	sdl.Arguments_ // promoted from struct: "Arguments []*ArgumentT"   ArgumenT {Name_, value InputValue_}, InputValue_ { InputValueProvider, Loc}
	sdl.Directives_
	SelectionSet []SelectionSetProvider //a Field whose type is an object (within the parent type to which field belongs) will have associated fields. For scalars SS wll be nil
	//
	Resolver func(context.Context, sdl.InputValueProvider, sdl.ObjectVals) <-chan string
}

func (*Field) AppendArgument

func (f *Field) AppendArgument(ss *sdl.ArgumentT)

func (*Field) AppendSelectionSet

func (f *Field) AppendSelectionSet(ss SelectionSetProvider)

func (*Field) AssignAlias

func (f *Field) AssignAlias(input string, loc *sdl.Loc_, err *[]error)

func (*Field) AssignName

func (f *Field) AssignName(input string, loc *sdl.Loc_, err *[]error)

func (*Field) ExpandArguments

func (f *Field) ExpandArguments(root *sdl.Field_, err *[]error) (failed bool)
type InputValueDef struct {
	Desc string
	Name_
	Type       *GQLtype
	DefaultVal *InputValue_
	Directives_
}
type Arguments_ struct {
	Arguments []*ArgumentT
}
type ArgumentT struct {
	//( name : value )
	Name_
	Value *InputValue_
}
func (a *Arguments_) AppendArgument(ss *ArgumentT) {
	a.Arguments = append(a.Arguments, ss)
}

func (*Field) GenNameAliasPath

func (f *Field) GenNameAliasPath() string

func (*Field) SelectionSetNode

func (f *Field) SelectionSetNode()

func (*Field) SolicitDependents

func (f *Field) SolicitDependents(unresolved sdl.UnresolvedMap)

func (*Field) StmtType

func (f *Field) StmtType() string

func (*Field) String

func (f *Field) String() string

type FragmentDef

type FragmentDef interface {
	FragmentNode()
	GetSelectionSet() []SelectionSetProvider
	// parse
	AssignTypeCond(string, *sdl.Loc_, *[]error)
	//	Executable
	AssignTypeCondAST(*[]error, *pse.Cache_)
}

type FragmentSpread

type FragmentSpread struct {
	sdl.Name_ // AST only contains reference to Fragment. At evaluation time it will be expanded to its enclosed fields.
	sdl.Directives_
	FragStmt *FragmentStmt // associated fragment statement

}

func (*FragmentSpread) AssignName

func (f *FragmentSpread) AssignName(input string, loc *sdl.Loc_, err *[]error)

func (*FragmentSpread) CheckInputValueType

func (f *FragmentSpread) CheckInputValueType(err *[]error)

func (*FragmentSpread) SelectionSetNode

func (f *FragmentSpread) SelectionSetNode()

func (*FragmentSpread) SolicitDependents

func (f *FragmentSpread) SolicitDependents(unresolved sdl.UnresolvedMap)

func (*FragmentSpread) StmtType

func (f *FragmentSpread) StmtType() string

func (*FragmentSpread) String

func (f *FragmentSpread) String() string

type FragmentStmt

type FragmentStmt struct {
	//NodeDef // partially implements Node interface - concrete type must assign its own String method
	//
	Name sdl.Name_
	// on <type>
	TypeCond    sdl.Name_
	TypeCondAST sdl.GQLTypeProvider
	sdl.Directives_
	SelectionSet []SelectionSetProvider // inline fragments, fragment spreads, sdl field from sdl type TypeCond.
}

func (*FragmentStmt) AppendSelectionSet

func (f *FragmentStmt) AppendSelectionSet(ss SelectionSetProvider)

func (*FragmentStmt) AssignName

func (f *FragmentStmt) AssignName(input string, loc *sdl.Loc_, err *[]error)

func (*FragmentStmt) AssignTypeCond

func (f *FragmentStmt) AssignTypeCond(input string, loc *sdl.Loc_, err *[]error)

func (*FragmentStmt) AssignTypeCondAST

func (f *FragmentStmt) AssignTypeCondAST(err *[]error, cache *pse.Cache_)

func (*FragmentStmt) CheckIsInputType

func (f *FragmentStmt) CheckIsInputType(err *[]error)

func (*FragmentStmt) FragmentNode

func (f *FragmentStmt) FragmentNode()

func (*FragmentStmt) GetSelectionSet

func (f *FragmentStmt) GetSelectionSet() []SelectionSetProvider

func (*FragmentStmt) SolicitDependents

func (f *FragmentStmt) SolicitDependents(unresolved sdl.UnresolvedMap)

func (*FragmentStmt) StatementNode

func (f *FragmentStmt) StatementNode()

func (*FragmentStmt) StmtName

func (f *FragmentStmt) StmtName() StmtName_

func (*FragmentStmt) StmtType

func (f *FragmentStmt) StmtType() string

func (*FragmentStmt) String

func (f *FragmentStmt) String() string

type GQLStmtProvider

type GQLStmtProvider interface {
	//Node()
	StatementNode()
	//TypeSystemNode()
	SolicitDependents(unresolved sdl.UnresolvedMap)
	CheckIsInputType(err *[]error)
	CheckInputValueType(err *[]error)
	StmtName() StmtName_
	StmtType() string
	String() string
}

type HasSelectionSetProvider

type HasSelectionSetProvider interface {
	AppendSelectionSet(ss SelectionSetProvider) // TODO - this method may not be appropriate for this interface.
}

these are the ast structures that have a selectionset collection, which maybe different to the objects contained in the selectionset

*OperationStmt) AppendSelectionSet(ss SelectionSetProvider) {
*FragmentStmt) AppendSelectionSet(ss SelectionSetProvider) {
*InlineFragment) AppendSelectionSet(ss SelectionSetProvider) {
*Field) AppendSelectionSet(ss SelectionSetProvider) {

type InlineFragment

type InlineFragment struct {
	//
	//Parent      HasSelectionSetProvider
	sdl.Name_                       // dummy name supplied to hold location info
	TypeCond    sdl.Name_           // supplied by typeCondition if specified, otherwise its the type of the parent object's selectionset.
	TypeCondAST sdl.GQLTypeProvider // populated during checkField??
	//
	sdl.Directives_
	SelectionSet []SelectionSetProvider // { only fields and ... fragments. Nil when no TypeCond and adopts selectionSet of enclosing context.
}

func (*InlineFragment) AppendSelectionSet

func (f *InlineFragment) AppendSelectionSet(ss SelectionSetProvider)

func (*InlineFragment) AssignTypeCond

func (f *InlineFragment) AssignTypeCond(input string, loc *sdl.Loc_, err *[]error)

func (*InlineFragment) AssignTypeCondAST

func (f *InlineFragment) AssignTypeCondAST(err *[]error, cache *pse.Cache_)

func (*InlineFragment) CheckInputValueType

func (f *InlineFragment) CheckInputValueType(err *[]error)

func (*InlineFragment) FragmentNode

func (f *InlineFragment) FragmentNode()

func (f *InlineFragment) Resolve() {}

func (*InlineFragment) GetSelectionSet

func (f *InlineFragment) GetSelectionSet() []SelectionSetProvider

func (*InlineFragment) SelectionSetNode

func (f *InlineFragment) SelectionSetNode()

func (*InlineFragment) SolicitDependents

func (f *InlineFragment) SolicitDependents(unresolved sdl.UnresolvedMap)

func (*InlineFragment) String

func (f *InlineFragment) String() string

type NameI

type NameI interface {
	AssignName(name string, loc *sdl.Loc_, err *[]error)
	StmtType() string
}

type OperationDef

type OperationDef interface {
	OperationNode()
}

type OperationStmt

type OperationStmt struct {
	//
	Type string // query, mutation, subscription	SelectionSet []SelectionSetProvider // { only fields and ... fragments
	//
	//NodeDef // partially implements Node interface - concrete type must assign its own String method
	//
	Name     sdl.Name_ // validated
	Variable []*VariableDef
	sdl.Directives_
	SelectionSet []SelectionSetProvider // { selection-List: fields,... }
}

func (*OperationStmt) AppendSelectionSet

func (o *OperationStmt) AppendSelectionSet(ss SelectionSetProvider)

func (*OperationStmt) AssignName

func (o *OperationStmt) AssignName(input string, loc *sdl.Loc_, err *[]error)

func (o *OperationStmt) ExecutableDefinition() {}

func (*OperationStmt) CheckInputValueType

func (o *OperationStmt) CheckInputValueType(err *[]error)

func (*OperationStmt) CheckIsInputType

func (o *OperationStmt) CheckIsInputType(err *[]error)

func (*OperationStmt) GetSelectionSet

func (o *OperationStmt) GetSelectionSet() []SelectionSetProvider

func (*OperationStmt) OperationNode

func (o *OperationStmt) OperationNode()

func (*OperationStmt) SolicitDependents

func (o *OperationStmt) SolicitDependents(unresolved sdl.UnresolvedMap)

func (*OperationStmt) StatementNode

func (o *OperationStmt) StatementNode()

func (*OperationStmt) StmtName

func (o *OperationStmt) StmtName() StmtName_

func (*OperationStmt) StmtType

func (o *OperationStmt) StmtType() string

func (*OperationStmt) String

func (o *OperationStmt) String() string

type PkRow

type PkRow struct {
	PKey  string
	SortK string
}

type QLInfo

type QLInfo struct {
	Dummy string
}

type Scalar_

type Scalar_ string

func (*Scalar_) Exists

func (sc *Scalar_) Exists() bool

func (*Scalar_) String

func (sc *Scalar_) String() string

func (*Scalar_) ValueNode

func (sc *Scalar_) ValueNode()

type SelectionSetProvider

type SelectionSetProvider interface {
	SelectionSetNode()
	SolicitDependents(unresolved sdl.UnresolvedMap) // TODO: don't like this here.
	//	Resolve()
	String() string
}

type Statement

type Statement struct {
	Type    string // Operational | Fragment
	Name    string
	AST     GQLStmtProvider     // AST of operational stmt (query,mutation,sub) or Fragment stmt
	RootAST sdl.GQLTypeProvider // AST of type which represents the entry point to the graph, from schema(query:<entryType>,... Typically type Query.
}

type StmtName_

type StmtName_ string

type TypeRow

type TypeRow struct {
	PKey  string
	SortK string
	Stmt  string
	Type  string //TODO: is this necessary?  Reason: is saves having to parse stmt in order to determine its "type"
}

type UnresolvedMap

type UnresolvedMap sdl.UnresolvedMap //¬333map[Name_]*sdl.GQLtype

type VariableDef

type VariableDef struct {
	sdl.Name_
	Type       *sdl.GQLtype
	DefaultVal *sdl.InputValue_
	Value      *sdl.InputValue_ // assigned by variable statment, defined outside of operationalStmt
}

func (*VariableDef) AssignName

func (v *VariableDef) AssignName(input string, loc *sdl.Loc_, err *[]error)

func (*VariableDef) AssignType

func (n *VariableDef) AssignType(t *sdl.GQLtype)

func (*VariableDef) SolicitDependents

func (n *VariableDef) SolicitDependents(unresolved sdl.UnresolvedMap)

func (*VariableDef) String

func (v *VariableDef) String() string

Jump to

Keyboard shortcuts

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