processor

package
v0.0.0-...-4eea697 Latest Latest
Warning

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

Go to latest
Published: Sep 26, 2023 License: Apache-2.0 Imports: 12 Imported by: 0

README

AQL Language Processor

In Files AqlLexer.g4 and parser.g4 contains AQL Syntax Specification on ANTLR4 grammar.

Instal ANTRL4

The getting started guide here

Guide for Go

The instruction to generate Go code

Generating code

Run bellow command to generate Go code

go generate .

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type AQLListener

type AQLListener struct {
	*parser.BaseAqlParserListener
	// contains filtered or unexported fields
}

func NewAQLListener

func NewAQLListener() *AQLListener

func (*AQLListener) EnterFromClause

func (aql *AQLListener) EnterFromClause(ctx *parser.FromClauseContext)

EnterFromClause is called when production fromClause is entered.

func (*AQLListener) EnterLimitClause

func (aql *AQLListener) EnterLimitClause(ctx *parser.LimitClauseContext)

EnterLimitClause is called when production limitClause is entered.

func (*AQLListener) EnterOrderByClause

func (aql *AQLListener) EnterOrderByClause(ctx *parser.OrderByClauseContext)

EnterOrderByClause is called when production orderByClause is entered.

func (*AQLListener) EnterSelectClause

func (aql *AQLListener) EnterSelectClause(ctx *parser.SelectClauseContext)

EnterSelectClause is called when production selectClause is entered.

func (*AQLListener) EnterWhereClause

func (aql *AQLListener) EnterWhereClause(ctx *parser.WhereClauseContext)

EnterWhereClause is called when production whereClause is entered.

func (*AQLListener) VisitTerminal

func (aql *AQLListener) VisitTerminal(node antlr.TerminalNode)

VisitTerminal is called when a terminal node is visited.

type AggregateFunctionCallSelectValue

type AggregateFunctionCallSelectValue struct {
}

type AqlProcessor

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

func NewAqlProcessor

func NewAqlProcessor(data string) *AqlProcessor

func (*AqlProcessor) Process

func (p *AqlProcessor) Process() (*Query, error)

type ArchetypePathPredicate

type ArchetypePathPredicate struct {
	ArchetypeHRID *string
	Parameter     *Parameter
}

type AtCode

type AtCode string

func (AtCode) ToString

func (code AtCode) ToString() string

type ClassExpression

type ClassExpression struct {
	Identifiers   []string
	PathPredicate *PathPredicate
}

type ComparisionSymbol

type ComparisionSymbol string
const (
	SymNone ComparisionSymbol = "NONE"
	SymLT   ComparisionSymbol = "<"
	SymGT   ComparisionSymbol = ">"
	SymLE   ComparisionSymbol = "<="
	SymGE   ComparisionSymbol = ">="
	SymNe   ComparisionSymbol = "!="
	SymEQ   ComparisionSymbol = "="
)

type ContainsExpr

type ContainsExpr struct {
	Operand  Operand
	Contains []*ContainsExpr
	Operator *OperatorType
	Brackets bool
}

type CustomErrorListener

type CustomErrorListener struct {
	*antlr.DefaultErrorListener // Embed default which ensures we fit the interface
	Errors                      []error
}

func (*CustomErrorListener) SyntaxError

func (c *CustomErrorListener) SyntaxError(recognizer antlr.Recognizer, offendingSymbol interface{}, line, column int, msg string, e antlr.RecognitionException)

type CustomSyntaxError

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

func (*CustomSyntaxError) Error

func (e *CustomSyntaxError) Error() string

type From

type From struct {
	ContainsExpr
}

type FunctionCallSelectValue

type FunctionCallSelectValue struct {
}

type IDCode

type IDCode string

type IdentifiedExpr

type IdentifiedExpr struct {
	Next               *IdentifiedExpr
	IsExists           bool
	IdentifiedPath     *IdentifiedPath
	Terminal           *Terminal
	ComparisonOperator *ComparisionSymbol

	Brackets bool
}

type IdentifiedPath

type IdentifiedPath struct {
	Identifier    string
	PathPredicate *PathPredicate
	ObjectPath    *ObjectPath
}

type IdentifiedPathSelectValue

type IdentifiedPathSelectValue struct {
	Val IdentifiedPath
}

type Limit

type Limit struct {
	Limit  int
	Offset int
}

type NodePredicate

type NodePredicate struct {
	Operator          OperatorType
	ComparisionSymbol ComparisionSymbol

	AtCode         *AtCode
	IDCode         *IDCode
	ArchetypeHRID  *string
	AdditionalData *NodePredicateAdditionalData

	Parameter            *Parameter
	Next                 []*NodePredicate
	ObjectPath           *ObjectPath
	PathPredicateOperand *PathPredicateOperand
	IsMatches            bool
	ContainedRegex       *string
}

type NodePredicateAdditionalData

type NodePredicateAdditionalData struct {
	String    *string
	Parameter *Parameter
	TermCode  *string
	AtCode    *AtCode
	IDCode    *IDCode
}

type ObjectPath

type ObjectPath struct {
	Paths []PartPath
}

type Operand

type Operand interface {
	// contains filtered or unexported methods
}

type OperatorType

type OperatorType string
const (
	NoneOperator OperatorType = "NONE"
	ANDOperator  OperatorType = "AND"
	OROperator   OperatorType = "OR"
	NOTOperator  OperatorType = "NOT"
)

type Order

type Order struct {
	Orders []OrderBy
}

type OrderBy

type OrderBy struct {
	IdentifierPath IdentifiedPath
	Ordering       OrderingType
}

type OrderingType

type OrderingType uint8
const (
	NoneOrdering OrderingType = iota
	DescendingOrdering
	AscendingOrdering
)

type Parameter

type Parameter string

type PartPath

type PartPath struct {
	Identifier    string
	PathPredicate *PathPredicate
}

type PathPredicate

type PathPredicate struct {
	Type PredicateType

	StandartPredicate *StandartPredicate
	NodePredicate     *NodePredicate
	Archetype         *ArchetypePathPredicate
}

type PathPredicateOperand

type PathPredicateOperand struct {
	Primitive  *Primitive
	ObjectPath *ObjectPath
	Parameter  *Parameter
	IDCode     *string
	AtCode     *string
}

type PredicateType

type PredicateType string
const (
	StandartPathPredicate   PredicateType = "STANDARD_PREDICATE"
	ArchetypedPathPredicate PredicateType = "ARCHETYPED_PREDICATE"
	NodePathPredicate       PredicateType = "NODE_PREDICATE"
)

type Primitive

type Primitive struct {
	Val  any
	Type int
}

func (Primitive) Compare

func (p Primitive) Compare(val any, cmpSymbl ComparisionSymbol) bool

type PrimitiveSelectValue

type PrimitiveSelectValue struct {
	Val Primitive
}

type Query

type Query struct {
	Select Select
	From   From
	Where  *Where
	Order  *Order
	Limit  *Limit

	Parameters map[string]*Parameter
}

func (*Query) ParametersCount

func (q *Query) ParametersCount() int

func (*Query) String

func (q *Query) String() string

type Select

type Select struct {
	Distinct    bool
	SelectExprs []SelectExpr
}

type SelectExpr

type SelectExpr struct {
	Value     SelectValuer
	Path      string
	AliasName string
}

type SelectValuer

type SelectValuer interface{}

type StandartPredicate

type StandartPredicate struct {
	ObjectPath  *ObjectPath
	CMPOperator ComparisionSymbol
	Operand     *PathPredicateOperand
}

standardPredicate: objectPath COMPARISON_OPERATOR pathPredicateOperand;

type Terminal

type Terminal struct {
	Primitive      *Primitive
	Parameter      *Parameter
	IdentifiedPath *IdentifiedPath
}

type VersionClassExpr

type VersionClassExpr struct {
	Version          string
	Variable         *string
	VersionPredicate *VersionPredicate
}

type VersionPredicate

type VersionPredicate struct {
	LatestVersion     *string
	AllVersions       *string
	StandartPredicate *StandartPredicate
}

type Where

type Where struct {
	IdentifiedExpr *IdentifiedExpr
	Next           []*Where
	OperatorType   OperatorType
	Brackets       bool
}

Jump to

Keyboard shortcuts

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