Documentation
¶
Index ¶
- Variables
- func GetAllRows(rs Cursor) ([][]Value, error)
- func GetParser(input string) *parser.CypherParser
- func IsPrimitive(v any) bool
- func OC_AnonymousPatternPart(ctx *parser.OC_AnonymousPatternPartContext, part *PatternPart) error
- func OC_FunctionName(ctx *parser.OC_FunctionNameContext) (namespace, name string)
- func OC_Namespace(ctx *parser.OC_NamespaceContext) string
- func OC_NodeLabels(ctx *parser.OC_NodeLabelsContext) []string
- func OC_PatternElement(ctx *parser.OC_PatternElementContext, part *PatternPart) error
- func OC_ProcedureName(ctx *parser.OC_ProcedureNameContext) (namespace, name string)
- func OC_PropertyKeyName(ctx *parser.OC_PropertyKeyNameContext) string
- func OC_PropertyLookup(ctx *parser.OC_PropertyLookupContext) string
- func OC_RelTypeName(ctx *parser.OC_RelTypeNameContext) string
- func OC_RelationshipTypes(ctx *parser.OC_RelationshipTypesContext) []string
- func OC_ReservedWord(ctx *parser.OC_ReservedWordContext) string
- func OC_SchemaName(ctx *parser.OC_SchemaNameContext) string
- func OC_StringOperatorExpression(ctx *parser.OC_StringOperatorExpressionContext) (op StringOperator, expr Expression, err error)
- func OC_SymbolicName(ctx *parser.OC_SymbolicNameContext) string
- func OC_Variable(ctx *parser.OC_VariableContext) string
- func RegisterGlobalFunc(fn ...Function)
- func RegisterGlobalProc(ps ...Procedure)
- func ResultRowToContext(row []Value, rs CursorColumns, target *EvalContext)
- type AddOrSubtractExpression
- type AdditiveOperator
- type AndExpression
- type BasicCursor
- type BasicCursorColumns
- type CaseAlternative
- type CaseClause
- type ComparisonExpression
- type ConjunctiveConstraint
- type Constraint
- type ConstraintOperator
- type CreateClause
- type Cursor
- type CursorColumn
- type CursorColumns
- type Date
- type DeleteClause
- type DisjunctiveConstraint
- type Duration
- type Edge
- type EdgeCriteria
- type EdgeDirection
- type ElementAccessExpression
- type ErrColumnsIncompatible
- type ErrInvalidExpression
- type ErrInvalidFunctionCall
- type ErrInvalidIndirection
- type ErrInvalidListIndex
- type ErrNodeAlreadyDefined
- type ErrNodeValueRequired
- type ErrResultFieldNotFound
- type ErrSyntax
- type ErrUnknownFunction
- type ErrUnknownParameter
- type ErrUnknownProcedure
- type ErrUnknownVariable
- type ErrVarRedefined
- type ErrorListener
- type EvalContext
- func (ctx *EvalContext) GetFunction(namespace, name string) (Function, error)
- func (ctx *EvalContext) GetParameter(key string) (Value, error)
- func (ctx *EvalContext) GetVar(name string) (Value, error)
- func (ctx *EvalContext) RemoveVar(name string)
- func (ctx *EvalContext) SetParameter(key string, value Value) *EvalContext
- func (ctx *EvalContext) SetVar(name string, value Value)
- func (ctx *EvalContext) String() string
- func (ctx *EvalContext) SubContext() *EvalContext
- func (ctx *EvalContext) VarDefined(name string) bool
- func (ctx *EvalContext) WithContext(c context.Context) *EvalContext
- type Expression
- func OC_AddOrSubtractExpression(ctx *parser.OC_AddOrSubtractExpressionContext) (Expression, error)
- func OC_AndExpression(ctx *parser.OC_AndExpressionContext) (Expression, error)
- func OC_Atom(ctx *parser.OC_AtomContext) (Expression, error)
- func OC_BooleanLiteral(ctx *parser.OC_BooleanLiteralContext) Expression
- func OC_CaseExpression(ctx *parser.OC_CaseExpressionContext) (Expression, error)
- func OC_ComparisonExpression(ctx *parser.OC_ComparisonExpressionContext) (Expression, error)
- func OC_DoubleLiteral(ctx *parser.OC_DoubleLiteralContext) (Expression, error)
- func OC_Expression(ctx *parser.OC_ExpressionContext) (Expression, error)
- func OC_FunctionInvocation(ctx *parser.OC_FunctionInvocationContext) (Expression, error)
- func OC_IntegerLiteral(ctx *parser.OC_IntegerLiteralContext) (Expression, error)
- func OC_Limit(ctx *parser.OC_LimitContext) (Expression, error)
- func OC_ListComprehension(ctx *parser.OC_ListComprehensionContext) (Expression, error)
- func OC_ListLiteral(ctx *parser.OC_ListLiteralContext) (Expression, error)
- func OC_ListOperatorExpression(ctx *parser.OC_ListOperatorExpressionContext) (in, e1, e2 Expression, err error)
- func OC_Literal(ctx *parser.OC_LiteralContext) (Expression, error)
- func OC_MapLiteral(ctx *parser.OC_MapLiteralContext) (Expression, error)
- func OC_MultiplyDivideModuloExpression(ctx *parser.OC_MultiplyDivideModuloExpressionContext) (Expression, error)
- func OC_NotExpression(ctx *parser.OC_NotExpressionContext) (Expression, error)
- func OC_NumberLiteral(ctx *parser.OC_NumberLiteralContext) (Expression, error)
- func OC_OrExpression(ctx *parser.OC_OrExpressionContext) (Expression, error)
- func OC_Parameter(ctx *parser.OC_ParameterContext) Expression
- func OC_PowerOfExpression(ctx *parser.OC_PowerOfExpressionContext) (Expression, error)
- func OC_PropertyExpression(ctx *parser.OC_PropertyExpressionContext) (Expression, error)
- func OC_PropertyOrLabelsExpression(ctx *parser.OC_PropertyOrLabelsExpressionContext) (Expression, error)
- func OC_Skip(ctx *parser.OC_SkipContext) (Expression, error)
- func OC_StringListNullOperatorExpression(ctx *parser.OC_StringListNullOperatorExpressionContext) (Expression, error)
- func OC_UnaryAddOrSubtractExpression(ctx *parser.OC_UnaryAddOrSubtractExpressionContext) (Expression, error)
- func OC_Where(ctx *parser.OC_WhereContext) (Expression, error)
- func OC_XorExpression(ctx *parser.OC_XorExpressionContext) (Expression, error)
- type FilterExpression
- type Function
- type FunctionInvocationExpression
- type Graph
- type GraphCursor
- type InExpression
- type LPGEdge
- func (edge LPGEdge) From() Node
- func (edge LPGEdge) GetProperties() map[string]Value
- func (edge LPGEdge) GetProperty(name string) Value
- func (edge LPGEdge) ID() any
- func (edge LPGEdge) Label() string
- func (edge LPGEdge) RemoveProperty(name string)
- func (edge LPGEdge) SetLabel(label string)
- func (edge LPGEdge) SetProperties(properties map[string]Value)
- func (edge LPGEdge) SetProperty(name string, value Value)
- func (edge LPGEdge) To() Node
- type LPGGraph
- func (g LPGGraph) DeleteEdge(edge Edge) error
- func (g LPGGraph) DetachDeleteNode(node Node) error
- func (g LPGGraph) NewEdge(from, to Node, label string, properties map[string]Value) (Edge, error)
- func (g LPGGraph) NewNode(labels []string, properties map[string]Value) (Node, error)
- func (g LPGGraph) SearchPattern(ctx *EvalContext, crit PathCriteria) (GraphCursor, error)
- type LPGGraphCursor
- type LPGNode
- func (node LPGNode) GetProperties() map[string]Value
- func (node LPGNode) GetProperty(name string) Value
- func (node LPGNode) HasIncomingEdges() bool
- func (node LPGNode) HasLabel(label string) bool
- func (node LPGNode) HasOutgoingEdges() bool
- func (node LPGNode) ID() any
- func (node LPGNode) Labels() []string
- func (node LPGNode) Native() any
- func (node LPGNode) RemoveProperty(name string)
- func (node LPGNode) SetLabels(labels []string)
- func (node LPGNode) SetProperties(properties map[string]Value)
- func (node LPGNode) SetProperty(name string, value Value)
- type LValue
- type ListComprehensionExpression
- type ListLiteral
- type LocalDateTime
- type LocalTime
- type MapLiteral
- type Match
- type MergeAction
- type MergeActionOn
- type MergeClause
- type MultiplicativeOperator
- type MultiplyDivideModuloExpression
- type Node
- type NodeCriteria
- type NodeLabelsConstraint
- type NodePattern
- type NontrivialConstraint
- type NotExpression
- type NullCheckConstraint
- type NullCheckExpression
- type OrExpression
- type Parameter
- type Path
- type PathCriteria
- type PathPattern
- type Pattern
- type PatternComprehension
- type PatternPart
- type PowerOfExpression
- type Procedure
- type ProcedureCall
- type ProcedureInvocation
- type ProjectionBody
- type ProjectionItem
- type Properties
- type PropertyCriteria
- type PropertyExpression
- type PropertyOrLabelsExpression
- type PropertyValueRange
- type Query
- type RValue
- type RangeLiteral
- type ReadingClause
- type RelationalConstraint
- type RelationshipPattern
- type RemoveClause
- type RemoveItem
- type Return
- type SetClause
- type SetItem
- type SingleQuery
- type SingleQueryStage
- type SortDirection
- type SortItem
- type StringConstraint
- type StringOperator
- type StringOperatorExpression
- type SublistExpression
- type Time
- type UnarySubtractExpression
- type Union
- type UnionStage
- type Unwind
- type UpdatingClause
- func OC_Create(ctx *parser.OC_CreateContext) (UpdatingClause, error)
- func OC_Delete(ctx *parser.OC_DeleteContext) (UpdatingClause, error)
- func OC_Merge(ctx *parser.OC_MergeContext) (UpdatingClause, error)
- func OC_Remove(ctx *parser.OC_RemoveContext) (UpdatingClause, error)
- func OC_Set(ctx *parser.OC_SetContext) (UpdatingClause, error)
- func OC_UpdatingClause(ctx *parser.OC_UpdatingClauseContext) (UpdatingClause, error)
- type Value
- type ValueConstraint
- type ValueType
- type VarConstraint
- type VariableAccessExpression
- type With
- type XorExpression
- type YieldItem
- type YieldItems
Constants ¶
This section is empty.
Variables ¶
var ( ErrInvalidAdditiveOperation = errors.New("Invalid additive operation") ErrInvalidDateOperation = errors.New("Invalid date operation") ErrInvalidDurationOperation = errors.New("Invalid duration operation") ErrInvalidStringOperation = errors.New("Invalid string operation") ErrInvalidMultiplicativeOperation = errors.New("Invalid multiplicative operation") ErrInvalidDivisionOperation = errors.New("Invalid division operation") ErrInvalidModOperation = errors.New("Invalid mod operation") ErrDivideByZero = errors.New("Divide by zero") ErrInvalidUnaryOperation = errors.New("Invalid unary operation") ErrInvalidPowerOperation = errors.New("Invalid power operation") )
var ( AdditionOperator AdditiveOperator = additionOperator{ // contains filtered or unexported fields } SubtractionOperator AdditiveOperator = subtractionOperator{ // contains filtered or unexported fields } MultiplicationOperator MultiplicativeOperator = multiplyOperator{ // contains filtered or unexported fields } DivisionOperator MultiplicativeOperator = divideOperator{ // contains filtered or unexported fields } ModOperator MultiplicativeOperator = modOperator{ // contains filtered or unexported fields } )
var ( ErrNotABooleanExpression = errors.New("Not a boolean expression") ErrNotAStringExpression = errors.New("Not a string expression") ErrIntRequired = errors.New("Integer value required") ErrNotAList = errors.New("Not a list") ErrNotANode = errors.New("Not a node") ErrParameterNotAnObject = errors.New("Parameter value is not an object") ErrInvalidComparison = errors.New("Invalid comparison") ErrNotAnObject = errors.New("Not an object") )
var ( ErrInvalidRelationshipPattern = errors.New("Invalid relationship pattern") ErrCannotDeleteAttachedNode = errors.New("Cannot delete attached node") ErrLValueRequired = errors.New("lvalue required") ErrNoBoundNodes = errors.New("No bound nodes in the match expression") ErrNotAnEdge = errors.New("Not a relationship") ErrBoundEdgeInMergeClause = errors.New("Bound edge in merge clause") ErrEdgeHasMultipleLabels = errors.New("Edge has multiple labels") ErrEdgeHasRange = errors.New("Edge has a range") )
var ErrColumnsHaveDifferentNames = errors.New("Columns have different names")
var ErrColumnsHaveDifferentTypes = errors.New("Columns have different types")
var ErrCursorsHaveDifferentSizes = errors.New("Cursors have different number of columns")
var ErrInvalidMapKey = errors.New("Invalid map key")
Functions ¶
func GetAllRows ¶
func GetParser ¶
func GetParser(input string) *parser.CypherParser
GetParser returns a parser that will parse the input string
func IsPrimitive ¶
IsPrimitive returns true if the value is int, float64, bool, string, duration, date, datetime, localDateTime, or localTime
func OC_AnonymousPatternPart ¶
func OC_AnonymousPatternPart(ctx *parser.OC_AnonymousPatternPartContext, part *PatternPart) error
oC_AnonymousPatternPart: oC_PatternElement ;
func OC_FunctionName ¶
func OC_FunctionName(ctx *parser.OC_FunctionNameContext) (namespace, name string)
func OC_Namespace ¶
func OC_Namespace(ctx *parser.OC_NamespaceContext) string
func OC_NodeLabels ¶
func OC_NodeLabels(ctx *parser.OC_NodeLabelsContext) []string
func OC_PatternElement ¶
func OC_PatternElement(ctx *parser.OC_PatternElementContext, part *PatternPart) error
oC_PatternElement:
( oC_NodePattern ( SP? oC_PatternElementChain )* ) | ( '(' oC_PatternElement ')' )
func OC_ProcedureName ¶
func OC_ProcedureName(ctx *parser.OC_ProcedureNameContext) (namespace, name string)
func OC_PropertyKeyName ¶
func OC_PropertyKeyName(ctx *parser.OC_PropertyKeyNameContext) string
func OC_PropertyLookup ¶
func OC_PropertyLookup(ctx *parser.OC_PropertyLookupContext) string
func OC_RelTypeName ¶
func OC_RelTypeName(ctx *parser.OC_RelTypeNameContext) string
func OC_RelationshipTypes ¶
func OC_RelationshipTypes(ctx *parser.OC_RelationshipTypesContext) []string
oC_RelationshipTypes: ':' SP? oC_RelTypeName ( SP? '|' ':'? SP? oC_RelTypeName )* ;
func OC_ReservedWord ¶
func OC_ReservedWord(ctx *parser.OC_ReservedWordContext) string
func OC_SchemaName ¶
func OC_SchemaName(ctx *parser.OC_SchemaNameContext) string
func OC_StringOperatorExpression ¶
func OC_StringOperatorExpression(ctx *parser.OC_StringOperatorExpressionContext) (op StringOperator, expr Expression, err error)
oC_StringOperatorExpression:
( ( SP STARTS SP WITH ) | ( SP ENDS SP WITH ) | ( SP CONTAINS ) ) SP? oC_PropertyOrLabelsExpression ;
func OC_SymbolicName ¶
func OC_SymbolicName(ctx *parser.OC_SymbolicNameContext) string
func OC_Variable ¶
func OC_Variable(ctx *parser.OC_VariableContext) string
func RegisterGlobalFunc ¶
func RegisterGlobalFunc(fn ...Function)
func RegisterGlobalProc ¶
func RegisterGlobalProc(ps ...Procedure)
func ResultRowToContext ¶
func ResultRowToContext(row []Value, rs CursorColumns, target *EvalContext)
Types ¶
type AddOrSubtractExpression ¶
type AddOrSubtractExpression struct { Expr []Expression Op []AdditiveOperator ResultType ValueType }
expr[0] op[0] expr[1] op[1] expr[2] ...
func (*AddOrSubtractExpression) Constraints ¶
func (expr *AddOrSubtractExpression) Constraints(ctx *EvalContext) Constraint
func (*AddOrSubtractExpression) Evaluate ¶
func (expr *AddOrSubtractExpression) Evaluate(ctx *EvalContext) (Value, error)
func (AddOrSubtractExpression) Tree ¶
func (expr AddOrSubtractExpression) Tree() any
func (AddOrSubtractExpression) Type ¶
func (expr AddOrSubtractExpression) Type() ValueType
type AdditiveOperator ¶
type AdditiveOperator interface {
// contains filtered or unexported methods
}
type AndExpression ¶
type AndExpression struct {
Parts []Expression
}
func (*AndExpression) Constraints ¶
func (expr *AndExpression) Constraints(ctx *EvalContext) Constraint
func (*AndExpression) Evaluate ¶
func (expr *AndExpression) Evaluate(ctx *EvalContext) (Value, error)
func (AndExpression) Tree ¶
func (expr AndExpression) Tree() any
func (AndExpression) Type ¶
func (AndExpression) Type() ValueType
type BasicCursor ¶
type BasicCursor struct { Cols BasicCursorColumns Rows [][]Value At int }
BasicCursor keeps all its rows and cols
func (BasicCursor) Column ¶
func (set BasicCursor) Column(index int) CursorColumn
func (BasicCursor) Err ¶
func (set BasicCursor) Err() error
func (BasicCursor) Len ¶
func (set BasicCursor) Len() int
func (BasicCursor) NColumns ¶
func (set BasicCursor) NColumns() int
func (*BasicCursor) Next ¶
func (set *BasicCursor) Next() bool
func (*BasicCursor) Row ¶
func (set *BasicCursor) Row() []Value
type BasicCursorColumns ¶
type BasicCursorColumns []CursorColumn
func NewBasicCursorColumns ¶
func NewBasicCursorColumns(in CursorColumns) BasicCursorColumns
func (BasicCursorColumns) Column ¶
func (b BasicCursorColumns) Column(index int) CursorColumn
func (BasicCursorColumns) NColumns ¶
func (b BasicCursorColumns) NColumns() int
type CaseAlternative ¶
type CaseAlternative struct { When Expression Then Expression }
func OC_CaseAlternative ¶
func OC_CaseAlternative(ctx *parser.OC_CaseAlternativesContext) (CaseAlternative, error)
type CaseClause ¶
type CaseClause struct { Test Expression Alternatives []CaseAlternative Default Expression ResultType ValueType }
func (*CaseClause) Constraints ¶
func (expr *CaseClause) Constraints(ctx *EvalContext) Constraint
func (*CaseClause) Evaluate ¶
func (expr *CaseClause) Evaluate(ctx *EvalContext) (Value, error)
func (CaseClause) Tree ¶
func (expr CaseClause) Tree() any
func (CaseClause) Type ¶
func (expr CaseClause) Type() ValueType
type ComparisonExpression ¶
type ComparisonExpression struct { Left Expression // Op accepts the result of the comparison as <0, 0, >0, and returns the comparison result Op func(int) bool OpStr string Right Expression }
func (*ComparisonExpression) Constraints ¶
func (expr *ComparisonExpression) Constraints(ctx *EvalContext) Constraint
func (*ComparisonExpression) Evaluate ¶
func (expr *ComparisonExpression) Evaluate(ctx *EvalContext) (Value, error)
func (ComparisonExpression) Tree ¶
func (expr ComparisonExpression) Tree() any
func (ComparisonExpression) Type ¶
func (ComparisonExpression) Type() ValueType
type ConjunctiveConstraint ¶
type ConjunctiveConstraint struct {
Parts []Constraint
}
func (ConjunctiveConstraint) BuildFilter ¶
func (c ConjunctiveConstraint) BuildFilter(varName string) map[string]PropertyCriteria
func (ConjunctiveConstraint) CanInvert ¶
func (c ConjunctiveConstraint) CanInvert() bool
func (ConjunctiveConstraint) Invert ¶
func (c ConjunctiveConstraint) Invert() Constraint
type Constraint ¶
type Constraint interface { CanInvert() bool Invert() Constraint BuildFilter(varName string) map[string]PropertyCriteria // contains filtered or unexported methods }
type ConstraintOperator ¶
type ConstraintOperator int
const (
NoConstraintOperator ConstraintOperator = iota
)
type CreateClause ¶
type CreateClause struct {
Pattern Pattern
}
func (CreateClause) Tree ¶
func (c CreateClause) Tree() any
func (*CreateClause) Update ¶
func (clause *CreateClause) Update(ctx *EvalContext, input Cursor) (Cursor, error)
type Cursor ¶
type Cursor interface { CursorColumns // Move to next item Next() bool // Return the row values for the current item Implementations should // lazy initialize this as Row() may be called multiple times for a // single row. Row() []Value // If length is unknown, returns -1 Len() int Err() error }
func ParseAndEvaluate ¶
func ParseAndEvaluate(input string, ctx *EvalContext) (Cursor, error)
type CursorColumn ¶
func (CursorColumn) IsCompatible ¶
func (c CursorColumn) IsCompatible(col CursorColumn) error
type CursorColumns ¶
type CursorColumns interface { NColumns() int Column(int) CursorColumn }
type Date ¶
type DeleteClause ¶
type DeleteClause struct { Detach bool Exprs []Expression }
func (DeleteClause) Tree ¶
func (d DeleteClause) Tree() any
func (*DeleteClause) Update ¶
func (del *DeleteClause) Update(ctx *EvalContext, input Cursor) (Cursor, error)
type DisjunctiveConstraint ¶
type DisjunctiveConstraint struct {
Parts []Constraint
}
func (DisjunctiveConstraint) BuildFilter ¶
func (c DisjunctiveConstraint) BuildFilter(varName string) map[string]PropertyCriteria
func (DisjunctiveConstraint) CanInvert ¶
func (c DisjunctiveConstraint) CanInvert() bool
func (DisjunctiveConstraint) Invert ¶
func (c DisjunctiveConstraint) Invert() Constraint
type EdgeCriteria ¶
type EdgeCriteria struct { Name string Dir EdgeDirection // The edges must have this label MustHaveLabel string // The edges must have at least one of these labels AtLeastOneLabel []string // Criteria for the properties Properties map[string]PropertyCriteria Min int Max int }
type EdgeDirection ¶
type EdgeDirection int
const ( EdgeDirectionRight EdgeDirection = iota EdgeDirectionLeft EdgeDirectionNone )
type ElementAccessExpression ¶
type ElementAccessExpression struct { Left Expression Key Expression }
func (*ElementAccessExpression) Constraints ¶
func (expr *ElementAccessExpression) Constraints(ctx *EvalContext) Constraint
func (*ElementAccessExpression) Evaluate ¶
func (expr *ElementAccessExpression) Evaluate(ctx *EvalContext) (Value, error)
func (ElementAccessExpression) Tree ¶
func (expr ElementAccessExpression) Tree() any
func (ElementAccessExpression) Type ¶
func (ElementAccessExpression) Type() ValueType
type ErrColumnsIncompatible ¶
func (ErrColumnsIncompatible) Error ¶
func (e ErrColumnsIncompatible) Error() string
func (ErrColumnsIncompatible) Unwrap ¶
func (e ErrColumnsIncompatible) Unwrap() error
type ErrInvalidExpression ¶
type ErrInvalidExpression struct {
Expr string
}
func (ErrInvalidExpression) Error ¶
func (e ErrInvalidExpression) Error() string
type ErrInvalidFunctionCall ¶
type ErrInvalidFunctionCall struct {
Msg string
}
func (ErrInvalidFunctionCall) Error ¶
func (e ErrInvalidFunctionCall) Error() string
type ErrInvalidIndirection ¶
type ErrInvalidIndirection struct {
Name string
}
func (ErrInvalidIndirection) Error ¶
func (err ErrInvalidIndirection) Error() string
type ErrInvalidListIndex ¶
type ErrInvalidListIndex struct {
Index any
}
func (ErrInvalidListIndex) Error ¶
func (err ErrInvalidListIndex) Error() string
type ErrNodeAlreadyDefined ¶
type ErrNodeAlreadyDefined struct {
Name string
}
func (ErrNodeAlreadyDefined) Error ¶
func (e ErrNodeAlreadyDefined) Error() string
type ErrNodeValueRequired ¶
type ErrNodeValueRequired struct {
Name string
}
func (ErrNodeValueRequired) Error ¶
func (e ErrNodeValueRequired) Error() string
type ErrResultFieldNotFound ¶
type ErrResultFieldNotFound struct {
Name string
}
func (ErrResultFieldNotFound) Error ¶
func (err ErrResultFieldNotFound) Error() string
type ErrUnknownFunction ¶
type ErrUnknownFunction struct {
Name string
}
func (ErrUnknownFunction) Error ¶
func (e ErrUnknownFunction) Error() string
type ErrUnknownParameter ¶
type ErrUnknownParameter struct {
Key string
}
func (ErrUnknownParameter) Error ¶
func (e ErrUnknownParameter) Error() string
type ErrUnknownProcedure ¶
type ErrUnknownProcedure struct {
Name string
}
func (ErrUnknownProcedure) Error ¶
func (err ErrUnknownProcedure) Error() string
type ErrUnknownVariable ¶
type ErrUnknownVariable struct {
Name string
}
func (ErrUnknownVariable) Error ¶
func (e ErrUnknownVariable) Error() string
type ErrVarRedefined ¶
type ErrVarRedefined struct {
Name string
}
func (ErrVarRedefined) Error ¶
func (e ErrVarRedefined) Error() string
type ErrorListener ¶
type ErrorListener struct { antlr.DefaultErrorListener // contains filtered or unexported fields }
func (*ErrorListener) Err ¶
func (lst *ErrorListener) Err() error
func (*ErrorListener) SyntaxError ¶
func (lst *ErrorListener) SyntaxError(recognizer antlr.Recognizer, offendingSymbol interface{}, line, column int, msg string, e antlr.RecognitionException)
type EvalContext ¶
func NewEvalContext ¶
func NewEvalContext(graph Graph) *EvalContext
func (*EvalContext) GetFunction ¶
func (ctx *EvalContext) GetFunction(namespace, name string) (Function, error)
func (*EvalContext) GetParameter ¶
func (ctx *EvalContext) GetParameter(key string) (Value, error)
func (*EvalContext) RemoveVar ¶
func (ctx *EvalContext) RemoveVar(name string)
func (*EvalContext) SetParameter ¶
func (ctx *EvalContext) SetParameter(key string, value Value) *EvalContext
SetParameter sets a parameter to be used in expressions
func (*EvalContext) SetVar ¶
func (ctx *EvalContext) SetVar(name string, value Value)
func (*EvalContext) String ¶
func (ctx *EvalContext) String() string
func (*EvalContext) SubContext ¶
func (ctx *EvalContext) SubContext() *EvalContext
SubContext creates a new subcontext with a new variable set
func (*EvalContext) VarDefined ¶
func (ctx *EvalContext) VarDefined(name string) bool
func (*EvalContext) WithContext ¶
func (ctx *EvalContext) WithContext(c context.Context) *EvalContext
Returns ctx with the new context
type Expression ¶
type Expression interface { Evaluate(*EvalContext) (Value, error) Constraints(*EvalContext) Constraint Type() ValueType Tree() any // contains filtered or unexported methods }
An Expression produces a value
func OC_AddOrSubtractExpression ¶
func OC_AddOrSubtractExpression(ctx *parser.OC_AddOrSubtractExpressionContext) (Expression, error)
oC_AddOrSubtractExpression :
oC_MultiplyDivideModuloExpression ( ( SP? '+' SP? oC_MultiplyDivideModuloExpression ) | ( SP? '-' SP? oC_MultiplyDivideModuloExpression ) )*
func OC_AndExpression ¶
func OC_AndExpression(ctx *parser.OC_AndExpressionContext) (Expression, error)
oC_AndExpression : oC_NotExpression ( SP AND SP oC_NotExpression )* ;
func OC_Atom ¶
func OC_Atom(ctx *parser.OC_AtomContext) (Expression, error)
oC_Atom: oC_Literal | oC_Parameter | oC_CaseExpression | ( COUNT SP? '(' SP? '*' SP? ')' ) | oC_ListComprehension | oC_PatternComprehension | ( ALL SP? '(' SP? oC_FilterExpression SP? ')' ) (all (x in list where predicate)) true if pred holds for all elems | ( ANY SP? '(' SP? oC_FilterExpression SP? ')' ) (any (x in list where predicate)) true if pred holds for at least one | ( NONE SP? '(' SP? oC_FilterExpression SP? ')' ) (none (x in list where predicate)) true if pred holds for none | ( SINGLE SP? '(' SP? oC_FilterExpression SP? ')' ) (single (x in list where predicate)) true if pred holds for one | oC_RelationshipsPattern | oC_ParenthesizedExpression | oC_FunctionInvocation | oC_Variable
func OC_BooleanLiteral ¶
func OC_BooleanLiteral(ctx *parser.OC_BooleanLiteralContext) Expression
func OC_CaseExpression ¶
func OC_CaseExpression(ctx *parser.OC_CaseExpressionContext) (Expression, error)
func OC_ComparisonExpression ¶
func OC_ComparisonExpression(ctx *parser.OC_ComparisonExpressionContext) (Expression, error)
oC_ComparisonExpression: oC_AddOrSubtractExpression ( SP? oC_PartialComparisonExpression )* ; oC_PartialComparisonExpression:
( '=' SP? oC_AddOrSubtractExpression ) | ( '<>' SP? oC_AddOrSubtractExpression ) | ( '<' SP? oC_AddOrSubtractExpression ) | ( '>' SP? oC_AddOrSubtractExpression ) | ( '<=' SP? oC_AddOrSubtractExpression ) | ( '>=' SP? oC_AddOrSubtractExpression )
func OC_DoubleLiteral ¶
func OC_DoubleLiteral(ctx *parser.OC_DoubleLiteralContext) (Expression, error)
func OC_Expression ¶
func OC_Expression(ctx *parser.OC_ExpressionContext) (Expression, error)
oC_Expression: oC_OrExpression ;
func OC_FunctionInvocation ¶
func OC_FunctionInvocation(ctx *parser.OC_FunctionInvocationContext) (Expression, error)
oC_FunctionInvocation:
oC_FunctionName SP? '(' SP? ( DISTINCT SP? )? ( oC_Expression SP? ( ',' SP? oC_Expression SP? )* )? ')' ;
func OC_IntegerLiteral ¶
func OC_IntegerLiteral(ctx *parser.OC_IntegerLiteralContext) (Expression, error)
oC_IntegerLiteral:
HexInteger | OctalInteger | DecimalInteger
func OC_Limit ¶
func OC_Limit(ctx *parser.OC_LimitContext) (Expression, error)
func OC_ListComprehension ¶
func OC_ListComprehension(ctx *parser.OC_ListComprehensionContext) (Expression, error)
oC_ListComprehension : '[' SP? oC_FilterExpression ( SP? '|' SP? oC_Expression )? SP? ']' ;
func OC_ListLiteral ¶
func OC_ListLiteral(ctx *parser.OC_ListLiteralContext) (Expression, error)
func OC_ListOperatorExpression ¶
func OC_ListOperatorExpression(ctx *parser.OC_ListOperatorExpressionContext) (in, e1, e2 Expression, err error)
oC_ListOperatorExpression:
( SP IN SP? oC_PropertyOrLabelsExpression ) | ( SP? '[' oC_Expression ']' ) | ( SP? '[' oC_Expression? '..' oC_Expression? ']' );
func OC_Literal ¶
func OC_Literal(ctx *parser.OC_LiteralContext) (Expression, error)
func OC_MapLiteral ¶
func OC_MapLiteral(ctx *parser.OC_MapLiteralContext) (Expression, error)
func OC_MultiplyDivideModuloExpression ¶
func OC_MultiplyDivideModuloExpression(ctx *parser.OC_MultiplyDivideModuloExpressionContext) (Expression, error)
oC_MultiplyDivideModuloExpression :
oC_PowerOfExpression ( ( SP? '*' SP? oC_PowerOfExpression ) | ( SP? '/' SP? oC_PowerOfExpression ) | ( SP? '%' SP? oC_PowerOfExpression ) )* ;
func OC_NotExpression ¶
func OC_NotExpression(ctx *parser.OC_NotExpressionContext) (Expression, error)
oC_NotExpression: ( NOT SP? )* oC_ComparisonExpression ;
func OC_NumberLiteral ¶
func OC_NumberLiteral(ctx *parser.OC_NumberLiteralContext) (Expression, error)
func OC_OrExpression ¶
func OC_OrExpression(ctx *parser.OC_OrExpressionContext) (Expression, error)
oC_OrExpression : oC_XorExpression ( SP OR SP oC_XorExpression )* ;
func OC_Parameter ¶
func OC_Parameter(ctx *parser.OC_ParameterContext) Expression
func OC_PowerOfExpression ¶
func OC_PowerOfExpression(ctx *parser.OC_PowerOfExpressionContext) (Expression, error)
oC_PowerOfExpression :
oC_UnaryAddOrSubtractExpression ( SP? '^' SP? oC_UnaryAddOrSubtractExpression )* ;
func OC_PropertyExpression ¶
func OC_PropertyExpression(ctx *parser.OC_PropertyExpressionContext) (Expression, error)
oC_PropertyExpression : oC_Atom ( SP? oC_PropertyLookup )+ ; Property expression names a property expression, it is not an lvalue
func OC_PropertyOrLabelsExpression ¶
func OC_PropertyOrLabelsExpression(ctx *parser.OC_PropertyOrLabelsExpressionContext) (Expression, error)
oC_PropertyOrLabelsExpression : oC_Atom ( SP? oC_PropertyLookup )* ( SP? oC_NodeLabels )? ;
func OC_Skip ¶
func OC_Skip(ctx *parser.OC_SkipContext) (Expression, error)
func OC_StringListNullOperatorExpression ¶
func OC_StringListNullOperatorExpression(ctx *parser.OC_StringListNullOperatorExpressionContext) (Expression, error)
oC_StringListNullOperatorExpression:
oC_PropertyOrLabelsExpression ( oC_StringOperatorExpression | oC_ListOperatorExpression | oC_NullOperatorExpression )* ;
func OC_UnaryAddOrSubtractExpression ¶
func OC_UnaryAddOrSubtractExpression(ctx *parser.OC_UnaryAddOrSubtractExpressionContext) (Expression, error)
oC_UnaryAddOrSubtractExpression: ( ( '+' | '-' ) SP? )* oC_StringListNullOperatorExpression ;
func OC_Where ¶
func OC_Where(ctx *parser.OC_WhereContext) (Expression, error)
func OC_XorExpression ¶
func OC_XorExpression(ctx *parser.OC_XorExpressionContext) (Expression, error)
oC_XorExpression : oC_AndExpression ( SP XOR SP oC_AndExpression )* ;
type FilterExpression ¶
type FilterExpression struct { Variable string InExpr Expression Where Expression }
func OC_FilterExpression ¶
func OC_FilterExpression(ctx *parser.OC_FilterExpressionContext) (*FilterExpression, error)
oC_FilterExpression : oC_IdInColl ( SP? oC_Where )? ; oC_IdInColl : oC_Variable SP IN SP oC_Expression ;
func (FilterExpression) Tree ¶
func (expr FilterExpression) Tree() any
func (FilterExpression) Type ¶
func (FilterExpression) Type() ValueType
type Function ¶
type Function struct { Name string MinArgs int MaxArgs int // If true, function does not have side effects Pure bool Func func(*EvalContext, []Expression) (Value, error) ValueFunc func(*EvalContext, []Value) (Value, error) }
Function describes a function
type FunctionInvocationExpression ¶
type FunctionInvocationExpression struct { Namespace string Name string Distinct bool Args []Expression }
func (*FunctionInvocationExpression) Constraints ¶
func (expr *FunctionInvocationExpression) Constraints(ctx *EvalContext) Constraint
func (*FunctionInvocationExpression) Evaluate ¶
func (expr *FunctionInvocationExpression) Evaluate(ctx *EvalContext) (Value, error)
func (FunctionInvocationExpression) Tree ¶
func (expr FunctionInvocationExpression) Tree() any
func (FunctionInvocationExpression) Type ¶
func (FunctionInvocationExpression) Type() ValueType
type GraphCursor ¶
type GraphCursor interface { Next() bool Path() Path // Return the value of the symbol in the current element SymbolValue(string) Value Err() error Close() }
A GraphCursor over the results of a patterh search. Cursor must be closed when done.
type InExpression ¶
type InExpression struct { Left Expression List Expression }
func (*InExpression) Constraints ¶
func (expr *InExpression) Constraints(ctx *EvalContext) Constraint
func (*InExpression) Evaluate ¶
func (expr *InExpression) Evaluate(ctx *EvalContext) (Value, error)
func (InExpression) Tree ¶
func (expr InExpression) Tree() any
func (InExpression) Type ¶
func (InExpression) Type() ValueType
type LPGEdge ¶
type LPGEdge struct {
Edge *lpg.Edge
}
func (LPGEdge) GetProperties ¶
func (LPGEdge) GetProperty ¶
func (LPGEdge) RemoveProperty ¶
func (LPGEdge) SetProperties ¶
func (LPGEdge) SetProperty ¶
type LPGGraph ¶
type LPGGraph struct {
Graph *lpg.Graph
}
func NewLPGGraph ¶
func NewLPGGraph(g *lpg.Graph) LPGGraph
func (LPGGraph) DeleteEdge ¶
func (LPGGraph) DetachDeleteNode ¶
func (LPGGraph) SearchPattern ¶
func (g LPGGraph) SearchPattern(ctx *EvalContext, crit PathCriteria) (GraphCursor, error)
type LPGGraphCursor ¶
type LPGGraphCursor struct {
// contains filtered or unexported fields
}
func (*LPGGraphCursor) Close ¶
func (cursor *LPGGraphCursor) Close()
func (*LPGGraphCursor) Err ¶
func (cursor *LPGGraphCursor) Err() error
func (*LPGGraphCursor) Next ¶
func (cursor *LPGGraphCursor) Next() bool
func (*LPGGraphCursor) Path ¶
func (cursor *LPGGraphCursor) Path() Path
func (*LPGGraphCursor) SymbolValue ¶
func (cursor *LPGGraphCursor) SymbolValue(sym string) Value
Return the value of the symbol in the current element
type LPGNode ¶
type LPGNode struct {
Node *lpg.Node
}
func (LPGNode) GetProperties ¶
func (LPGNode) GetProperty ¶
func (LPGNode) HasIncomingEdges ¶
func (LPGNode) HasOutgoingEdges ¶
func (LPGNode) RemoveProperty ¶
func (LPGNode) SetProperties ¶
func (LPGNode) SetProperty ¶
type LValue ¶
type LValue struct {
// contains filtered or unexported fields
}
LValue is a pointer to a value
func (LValue) Constraints ¶
func (expr LValue) Constraints(ctx *EvalContext) Constraint
type ListComprehensionExpression ¶
type ListComprehensionExpression struct { Filter *FilterExpression Expr Expression }
func (*ListComprehensionExpression) Constraints ¶
func (expr *ListComprehensionExpression) Constraints(ctx *EvalContext) Constraint
func (*ListComprehensionExpression) Evaluate ¶
func (expr *ListComprehensionExpression) Evaluate(ctx *EvalContext) (Value, error)
func (ListComprehensionExpression) Tree ¶
func (expr ListComprehensionExpression) Tree() any
func (ListComprehensionExpression) Type ¶
func (ListComprehensionExpression) Type() ValueType
type ListLiteral ¶
type ListLiteral struct { Values []Expression Const Value }
func (*ListLiteral) Constraints ¶
func (expr *ListLiteral) Constraints(ctx *EvalContext) Constraint
func (*ListLiteral) Evaluate ¶
func (expr *ListLiteral) Evaluate(ctx *EvalContext) (Value, error)
func (ListLiteral) Tree ¶
func (l ListLiteral) Tree() any
func (ListLiteral) Type ¶
func (ListLiteral) Type() ValueType
type LocalDateTime ¶
func NewLocalDateTime ¶
func NewLocalDateTime(t time.Time) LocalDateTime
NewLocalDateTime creates a LocalDateTime from time.Time.
func (LocalDateTime) String ¶
func (t LocalDateTime) String() string
func (LocalDateTime) Time ¶
func (t LocalDateTime) Time() time.Time
Time casts LocalDateTime to time.Time
type LocalTime ¶
func NewLocalTime ¶
NewLocalTime creates a LocalTime from time.Time. Year, month and day are set to zero and location is set to local.
type MapLiteral ¶
type MapLiteral struct { Val map[string]Expression Const Value }
func (*MapLiteral) Constraints ¶
func (expr *MapLiteral) Constraints(ctx *EvalContext) Constraint
func (*MapLiteral) Evaluate ¶
func (expr *MapLiteral) Evaluate(ctx *EvalContext) (Value, error)
func (MapLiteral) Tree ¶
func (l MapLiteral) Tree() any
func (MapLiteral) Type ¶
func (MapLiteral) Type() ValueType
type Match ¶
type Match struct { Optional bool Pattern Pattern Where Expression }
func OC_Match ¶
func OC_Match(ctx *parser.OC_MatchContext) (ret *Match, err error)
oC_Match:
( OPTIONAL SP )? MATCH SP? oC_Pattern ( SP? oC_Where )? ;
func (Match) IsOptional ¶
type MergeAction ¶
type MergeAction struct { On MergeActionOn Set UpdatingClause }
type MergeActionOn ¶
type MergeActionOn int
const ( MergeActionOnMatch MergeActionOn = iota MergeActionOnCreate )
func (MergeActionOn) String ¶
func (m MergeActionOn) String() string
type MergeClause ¶
type MergeClause struct { Pattern PatternPart Actions []MergeAction }
func (MergeClause) Tree ¶
func (m MergeClause) Tree() any
func (*MergeClause) Update ¶
func (merge *MergeClause) Update(ctx *EvalContext, input Cursor) (Cursor, error)
type MultiplicativeOperator ¶
type MultiplicativeOperator interface {
// contains filtered or unexported methods
}
type MultiplyDivideModuloExpression ¶
type MultiplyDivideModuloExpression struct { Expr []Expression Op []MultiplicativeOperator ResultType ValueType }
func (*MultiplyDivideModuloExpression) Constraints ¶
func (expr *MultiplyDivideModuloExpression) Constraints(ctx *EvalContext) Constraint
func (*MultiplyDivideModuloExpression) Evaluate ¶
func (expr *MultiplyDivideModuloExpression) Evaluate(ctx *EvalContext) (Value, error)
func (MultiplyDivideModuloExpression) Tree ¶
func (expr MultiplyDivideModuloExpression) Tree() any
func (MultiplyDivideModuloExpression) Type ¶
func (expr MultiplyDivideModuloExpression) Type() ValueType
type NodeCriteria ¶
type NodeLabelsConstraint ¶
func (NodeLabelsConstraint) BuildFilter ¶
func (c NodeLabelsConstraint) BuildFilter(varName string) map[string]PropertyCriteria
func (NodeLabelsConstraint) CanInvert ¶
func (NodeLabelsConstraint) CanInvert() bool
func (NodeLabelsConstraint) Invert ¶
func (NodeLabelsConstraint) Invert() Constraint
type NodePattern ¶
type NodePattern struct { VariableName string Labels []string Properties *Properties }
func OC_NodePattern ¶
func OC_NodePattern(ctx *parser.OC_NodePatternContext) (ret NodePattern, err error)
oC_NodePattern:
'(' SP? ( oC_Variable SP? )? ( oC_NodeLabels SP? )? ( oC_Properties SP? )? ')' ;
func (NodePattern) GetNodeCriteria ¶
func (node NodePattern) GetNodeCriteria(ctx *EvalContext) (NodeCriteria, error)
func (NodePattern) Tree ¶
func (node NodePattern) Tree() any
type NontrivialConstraint ¶
type NontrivialConstraint struct{}
func (NontrivialConstraint) BuildFilter ¶
func (NontrivialConstraint) BuildFilter(varName string) map[string]PropertyCriteria
func (NontrivialConstraint) CanInvert ¶
func (NontrivialConstraint) CanInvert() bool
func (NontrivialConstraint) Invert ¶
func (NontrivialConstraint) Invert() Constraint
type NotExpression ¶
type NotExpression struct {
Part Expression
}
func (*NotExpression) Constraints ¶
func (expr *NotExpression) Constraints(ctx *EvalContext) Constraint
func (*NotExpression) Evaluate ¶
func (expr *NotExpression) Evaluate(ctx *EvalContext) (Value, error)
func (NotExpression) Tree ¶
func (expr NotExpression) Tree() any
func (NotExpression) Type ¶
func (NotExpression) Type() ValueType
type NullCheckConstraint ¶
type NullCheckConstraint struct { Var VarConstraint IsNull bool }
func (NullCheckConstraint) BuildFilter ¶
func (c NullCheckConstraint) BuildFilter(varName string) map[string]PropertyCriteria
func (NullCheckConstraint) CanInvert ¶
func (NullCheckConstraint) CanInvert() bool
func (NullCheckConstraint) Invert ¶
func (c NullCheckConstraint) Invert() Constraint
type NullCheckExpression ¶
type NullCheckExpression struct { Left Expression CheckIsNull bool }
func (*NullCheckExpression) Constraints ¶
func (expr *NullCheckExpression) Constraints(ctx *EvalContext) Constraint
func (*NullCheckExpression) Evaluate ¶
func (expr *NullCheckExpression) Evaluate(ctx *EvalContext) (Value, error)
func (NullCheckExpression) Tree ¶
func (expr NullCheckExpression) Tree() any
func (NullCheckExpression) Type ¶
func (NullCheckExpression) Type() ValueType
type OrExpression ¶
type OrExpression struct {
Parts []Expression
}
func (*OrExpression) Constraints ¶
func (expr *OrExpression) Constraints(ctx *EvalContext) Constraint
func (*OrExpression) Evaluate ¶
func (expr *OrExpression) Evaluate(ctx *EvalContext) (Value, error)
func (OrExpression) Tree ¶
func (expr OrExpression) Tree() any
func (OrExpression) Type ¶
func (OrExpression) Type() ValueType
type Parameter ¶
type Parameter struct {
Name string
}
func (*Parameter) Constraints ¶
func (expr *Parameter) Constraints(ctx *EvalContext) Constraint
type PathCriteria ¶
type PathCriteria struct { Nodes []NodeCriteria Edges []EdgeCriteria }
type PathPattern ¶
type PathPattern struct { Nodes []NodePattern Rels []RelationshipPattern }
func OC_RelationshipsPattern ¶
func OC_RelationshipsPattern(ctx *parser.OC_RelationshipsPatternContext) (*PathPattern, error)
oC_RelationshipsPattern : oC_NodePattern ( SP? oC_PatternElementChain )+ ; oC_PatternElementChain : oC_RelationshipPattern SP? oC_NodePattern ;
func (*PathPattern) Constraints ¶
func (expr *PathPattern) Constraints(*EvalContext) Constraint
func (*PathPattern) Evaluate ¶
func (expr *PathPattern) Evaluate(*EvalContext) (Value, error)
func (PathPattern) GetFreeVariables ¶
func (p PathPattern) GetFreeVariables(ctx *EvalContext, offset int) []CursorColumn
Returns the free variables in the order they are defined. A free variable is one that is not defined in the context. The result set colum indexes start from the given offset
func (PathPattern) Tree ¶
func (p PathPattern) Tree() any
func (PathPattern) Type ¶
func (PathPattern) Type() ValueType
type Pattern ¶
type Pattern struct {
JoinParts []PatternPart
}
func OC_Pattern ¶
func OC_Pattern(ctx *parser.OC_PatternContext) (Pattern, error)
oC_Pattern:
oC_PatternPart ( SP? ',' SP? oC_PatternPart )* ;
type PatternComprehension ¶
type PatternComprehension struct { Variable string Rel *PathPattern Where Expression Expr Expression }
func OC_PatternComprehension ¶
func OC_PatternComprehension(ctx *parser.OC_PatternComprehensionContext) (*PatternComprehension, error)
oC_PatternComprehension:
'[' SP? ( oC_Variable SP? '=' SP? )? oC_RelationshipsPattern SP? ( WHERE SP? oC_Expression SP? )? '|' SP? oC_Expression SP? ']'
func (*PatternComprehension) Constraints ¶
func (*PatternComprehension) Constraints(*EvalContext) Constraint
func (*PatternComprehension) Evaluate ¶
func (*PatternComprehension) Evaluate(*EvalContext) (Value, error)
func (PatternComprehension) Tree ¶
func (expr PatternComprehension) Tree() any
func (PatternComprehension) Type ¶
func (PatternComprehension) Type() ValueType
type PatternPart ¶
type PatternPart struct { VariableName string Path PathPattern }
func OC_PatternPart ¶
func OC_PatternPart(ctx *parser.OC_PatternPartContext) (ret PatternPart, err error)
oC_PatternPart:
( oC_Variable SP? '=' SP? oC_AnonymousPatternPart ) | oC_AnonymousPatternPart
func (PatternPart) Tree ¶
func (p PatternPart) Tree() any
type PowerOfExpression ¶
type PowerOfExpression struct {
Expr []Expression
}
func (*PowerOfExpression) Constraints ¶
func (expr *PowerOfExpression) Constraints(ctx *EvalContext) Constraint
func (*PowerOfExpression) Evaluate ¶
func (expr *PowerOfExpression) Evaluate(ctx *EvalContext) (Value, error)
func (PowerOfExpression) Tree ¶
func (expr PowerOfExpression) Tree() any
func (PowerOfExpression) Type ¶
func (expr PowerOfExpression) Type() ValueType
type Procedure ¶
type Procedure struct { Name string MinArgs int MaxArgs int Cols []CursorColumn Proc func(*EvalContext, []Expression) (Cursor, error) }
Procedure describes a global procedure
type ProcedureCall ¶
type ProcedureCall struct { Proc *ProcedureInvocation Yield *YieldItems }
func OC_InQueryCall ¶
func OC_InQueryCall(ctx *parser.OC_InQueryCallContext) (*ProcedureCall, error)
oC_InQueryCall:
CALL SP oC_ExplicitProcedureInvocation ( SP? YIELD SP oC_YieldItems )? ;
func OC_StandaloneCall ¶
func OC_StandaloneCall(ctx *parser.OC_StandaloneCallContext) (*ProcedureCall, error)
oC_StandaloneCall:
CALL SP ( oC_ExplicitProcedureInvocation | oC_ImplicitProcedureInvocation ) ( SP YIELD SP oC_YieldItems )? ;
func (*ProcedureCall) GetCursor ¶
func (call *ProcedureCall) GetCursor(ctx *EvalContext) (Cursor, error)
func (ProcedureCall) IsOptional ¶
func (ProcedureCall) IsOptional() bool
func (ProcedureCall) Tree ¶
func (c ProcedureCall) Tree() any
type ProcedureInvocation ¶
type ProcedureInvocation struct { Namespace string Name string Args []Expression }
func OC_ExplicitProcedureInvocation ¶
func OC_ExplicitProcedureInvocation(ctx *parser.OC_ExplicitProcedureInvocationContext) (*ProcedureInvocation, error)
oC_ExplicitProcedureInvocation:
oC_ProcedureName SP? '(' SP? ( oC_Expression SP? ( ',' SP? oC_Expression SP? )* )? ')' ;
func OC_ImplicitProcedureInvocation ¶
func OC_ImplicitProcedureInvocation(ctx *parser.OC_ImplicitProcedureInvocationContext) (*ProcedureInvocation, error)
oC_ImplicitProcedureInvocation: oC_ProcedureName
func (ProcedureInvocation) Tree ¶
func (p ProcedureInvocation) Tree() any
type ProjectionBody ¶
type ProjectionBody struct { Distinct bool Items []ProjectionItem Order []SortItem Skip Expression Limit Expression }
func OC_ProjectionBody ¶
func OC_ProjectionBody(ctx *parser.OC_ProjectionBodyContext) (*ProjectionBody, error)
oC_ProjectionBody:
( SP? DISTINCT )? SP oC_ProjectionItems ( SP oC_Order )? ( SP oC_Skip )? ( SP oC_Limit )? ;
func (*ProjectionBody) Project ¶
func (prj *ProjectionBody) Project(ctx *EvalContext, rs Cursor) (Cursor, error)
func (ProjectionBody) Tree ¶
func (p ProjectionBody) Tree() any
type ProjectionItem ¶
type ProjectionItem struct { All bool Alias string Expr Expression }
func OC_ProjectionItem ¶
func OC_ProjectionItem(ctx *parser.OC_ProjectionItemContext) (item ProjectionItem, err error)
oC_ProjectionItem:
( oC_Expression SP AS SP oC_Variable )| oC_Expression
func OC_ProjectionItems ¶
func OC_ProjectionItems(ctx *parser.OC_ProjectionItemsContext) ([]ProjectionItem, error)
oC_ProjectionItems:
( '*' ( SP? ',' SP? oC_ProjectionItem )* ) | ( oC_ProjectionItem ( SP? ',' SP? oC_ProjectionItem )* )
func (ProjectionItem) Tree ¶
func (p ProjectionItem) Tree() any
type Properties ¶
type Properties struct { Lit *MapLiteral Param *Parameter }
func OC_Properties ¶
func OC_Properties(ctx *parser.OC_PropertiesContext) (Properties, error)
oC_Properties : oC_MapLiteral | oC_Parameter
func (*Properties) Evaluate ¶
func (expr *Properties) Evaluate(ctx *EvalContext) (Value, error)
func (Properties) Tree ¶
func (p Properties) Tree() any
type PropertyCriteria ¶
type PropertyCriteria struct { PropertyName string // Property value is equal to one of the given values OneOf []Value // Property value has the given prefix/suffix or substring StringValue string StringOp StringOperator // Value ranges Ranges []PropertyValueRange }
PropertyCriteria values are ORed. For instance, if there is one of values and a prefix, all values that have that prefix and oneof values will match
type PropertyExpression ¶
type PropertyExpression struct { Atom Expression Property []string }
PropertyExpression represents an expression of the form: (value).property1.property2... This is used in update expressions
func (*PropertyExpression) Constraints ¶
func (expr *PropertyExpression) Constraints(ctx *EvalContext) Constraint
func (*PropertyExpression) Evaluate ¶
func (expr *PropertyExpression) Evaluate(ctx *EvalContext) (Value, error)
func (PropertyExpression) Tree ¶
func (expr PropertyExpression) Tree() any
func (PropertyExpression) Type ¶
func (PropertyExpression) Type() ValueType
type PropertyOrLabelsExpression ¶
type PropertyOrLabelsExpression struct { Atom Expression Properties []string NodeLabels []string }
func (*PropertyOrLabelsExpression) Constraints ¶
func (expr *PropertyOrLabelsExpression) Constraints(ctx *EvalContext) Constraint
func (*PropertyOrLabelsExpression) Evaluate ¶
func (expr *PropertyOrLabelsExpression) Evaluate(ctx *EvalContext) (Value, error)
func (PropertyOrLabelsExpression) Tree ¶
func (expr PropertyOrLabelsExpression) Tree() any
func (PropertyOrLabelsExpression) Type ¶
func (expr PropertyOrLabelsExpression) Type() ValueType
type PropertyValueRange ¶
type Query ¶
type Query interface { GetCursor(*EvalContext) (Cursor, error) Tree() any // contains filtered or unexported methods }
A query is a clause that produces a resultset
func OC_Cypher ¶
func OC_Cypher(ctx *parser.OC_CypherContext) (Query, error)
oC_Cypher : SP? oC_Statement ( SP? ';' )? SP? EOF ;
func OC_Query ¶
func OC_Query(ctx *parser.OC_QueryContext) (Query, error)
oC_Query : oC_RegularQuery | oC_StandaloneCall;
func OC_RegularQuery ¶
func OC_RegularQuery(ctx *parser.OC_RegularQueryContext) (Query, error)
oC_RegularQuery : oC_SingleQuery ( SP? oC_Union )* ; oC_Union : ( UNION SP ALL SP? oC_SingleQuery ) | ( UNION SP? oC_SingleQuery ) ;
func OC_Statement ¶
func OC_Statement(ctx *parser.OC_StatementContext) (Query, error)
oC_Statement : oC_Query ;
type RValue ¶
RValue is a value
func (RValue) Constraints ¶
func (expr RValue) Constraints(ctx *EvalContext) Constraint
type RangeLiteral ¶
func OC_RangeLiteral ¶
func OC_RangeLiteral(ctx *parser.OC_RangeLiteralContext) (RangeLiteral, error)
oC_RangeLiteral : '*' SP? ( oC_IntegerLiteral SP? )? ( '..' SP? ( oC_IntegerLiteral SP? )? )? ;
func (RangeLiteral) Tree ¶
func (r RangeLiteral) Tree() any
type ReadingClause ¶
type ReadingClause interface { GetCursor(*EvalContext) (Cursor, error) IsOptional() bool Tree() any // contains filtered or unexported methods }
func OC_ReadingClause ¶
func OC_ReadingClause(ctx *parser.OC_ReadingClauseContext) (ReadingClause, error)
oC_ReadingClause : oC_Match | oC_Unwind | oC_InQueryCall ;
type RelationalConstraint ¶
type RelationalConstraint struct { Var VarConstraint Op string Value Value }
func (RelationalConstraint) BuildFilter ¶
func (c RelationalConstraint) BuildFilter(varName string) map[string]PropertyCriteria
func (RelationalConstraint) CanInvert ¶
func (RelationalConstraint) CanInvert() bool
func (RelationalConstraint) Invert ¶
func (c RelationalConstraint) Invert() Constraint
type RelationshipPattern ¶
type RelationshipPattern struct { ToLeft bool ToRight bool VariableName string RelTypes []string Range *RangeLiteral Properties *Properties }
func OC_RelationshipPattern ¶
func OC_RelationshipPattern(ctx *parser.OC_RelationshipPatternContext) (ret RelationshipPattern, err error)
oC_RelationshipPattern:
( oC_LeftArrowHead SP? oC_Dash SP? oC_RelationshipDetail? SP? oC_Dash SP? oC_RightArrowHead ) | ( oC_LeftArrowHead SP? oC_Dash SP? oC_RelationshipDetail? SP? oC_Dash ) | ( oC_Dash SP? oC_RelationshipDetail? SP? oC_Dash SP? oC_RightArrowHead ) | ( oC_Dash SP? oC_RelationshipDetail? SP? oC_Dash )
func (RelationshipPattern) Tree ¶
func (rel RelationshipPattern) Tree() any
type RemoveClause ¶
type RemoveClause struct {
Items []RemoveItem
}
func (RemoveClause) Tree ¶
func (r RemoveClause) Tree() any
func (*RemoveClause) Update ¶
func (rm *RemoveClause) Update(ctx *EvalContext, input Cursor) (Cursor, error)
type RemoveItem ¶
type RemoveItem struct { Variable *VariableAccessExpression NodeLabels []string Property *PropertyExpression }
func OC_RemoveItem ¶
func OC_RemoveItem(ctx *parser.OC_RemoveItemContext) (RemoveItem, error)
oC_RemoveItem :
( oC_Variable oC_NodeLabels ) | oC_PropertyExpression
func (RemoveItem) DeleteLabel ¶
func (r RemoveItem) DeleteLabel(l string) bool
Returns if the label is to be deleted
func (RemoveItem) Tree ¶
func (r RemoveItem) Tree() any
type Return ¶
type Return struct {
Projection *ProjectionBody
}
type SetItem ¶
type SetItem struct { Property *PropertyExpression Variable *VariableAccessExpression Op string Expression Expression NodeLabels []string }
func OC_SetItem ¶
func OC_SetItem(ctx *parser.OC_SetItemContext) (SetItem, error)
oC_SetItem:
( oC_PropertyExpression SP? '=' SP? oC_Expression ) | ( oC_Variable SP? '=' SP? oC_Expression ) | ( oC_Variable SP? '+=' SP? oC_Expression ) | ( oC_Variable SP? oC_NodeLabels ) ;
type SingleQuery ¶
type SingleQuery struct { Stages []SingleQueryStage Ret *Return // contains filtered or unexported fields }
A single query contains a pipeline of (read-update-with) constructs, and then a projection
func OC_MultiPartQuery ¶
func OC_MultiPartQuery(ctx *parser.OC_MultiPartQueryContext) (*SingleQuery, error)
oC_MultiPartQuery
: ( ( oC_ReadingClause SP? )* ( oC_UpdatingClause SP? )* oC_With SP? )+ oC_SinglePartQuery ;
func OC_SinglePartQuery ¶
func OC_SinglePartQuery(ctx *parser.OC_SinglePartQueryContext) (*SingleQuery, error)
oC_SinglePartQuery :
( ( oC_ReadingClause SP? )* oC_Return ) | ( ( oC_ReadingClause SP? )* oC_UpdatingClause ( SP? oC_UpdatingClause )* ( SP? oC_Return )? )
func OC_SingleQuery ¶
func OC_SingleQuery(ctx *parser.OC_SingleQueryContext) (ret *SingleQuery, err error)
oC_SingleQuery : oC_SinglePartQuery | oC_MultiPartQuery ;
func (*SingleQuery) GetCursor ¶
func (query *SingleQuery) GetCursor(ctx *EvalContext) (Cursor, error)
func (*SingleQuery) IsOptional ¶
func (*SingleQuery) IsOptional() bool
func (SingleQuery) Tree ¶
func (u SingleQuery) Tree() any
type SingleQueryStage ¶
type SingleQueryStage struct { Read []ReadingClause Update []UpdatingClause With *With }
type SortDirection ¶
type SortDirection int
const ( SortAscending SortDirection = iota SortDescending )
func (SortDirection) String ¶
func (s SortDirection) String() string
type SortItem ¶
type SortItem struct { Dir SortDirection Expr Expression }
func OC_Order ¶
func OC_Order(ctx *parser.OC_OrderContext) ([]SortItem, error)
oC_Order:
ORDER SP BY SP oC_SortItem ( ',' SP? oC_SortItem )*
func OC_SortItem ¶
func OC_SortItem(ctx *parser.OC_SortItemContext) (ret SortItem, err error)
oC_SortItem:
oC_Expression ( SP? ( ASCENDING | ASC | DESCENDING | DESC ) )? ;
type StringConstraint ¶
type StringConstraint struct { Var VarConstraint Op StringOperator Value string }
func (StringConstraint) BuildFilter ¶
func (c StringConstraint) BuildFilter(varName string) map[string]PropertyCriteria
func (StringConstraint) CanInvert ¶
func (StringConstraint) CanInvert() bool
func (StringConstraint) Invert ¶
func (StringConstraint) Invert() Constraint
type StringOperator ¶
type StringOperator int
const ( StringOperatorStartsWith StringOperator = iota StringOperatorEndsWith StringOperatorContains )
func (StringOperator) String ¶
func (s StringOperator) String() string
type StringOperatorExpression ¶
type StringOperatorExpression struct { Left Expression Op StringOperator Right Expression }
func (*StringOperatorExpression) Constraints ¶
func (expr *StringOperatorExpression) Constraints(ctx *EvalContext) Constraint
func (*StringOperatorExpression) Evaluate ¶
func (expr *StringOperatorExpression) Evaluate(ctx *EvalContext) (Value, error)
func (StringOperatorExpression) Tree ¶
func (expr StringOperatorExpression) Tree() any
func (StringOperatorExpression) Type ¶
func (StringOperatorExpression) Type() ValueType
type SublistExpression ¶
type SublistExpression struct { Left Expression From Expression To Expression }
func (*SublistExpression) Constraints ¶
func (expr *SublistExpression) Constraints(ctx *EvalContext) Constraint
func (*SublistExpression) Evaluate ¶
func (expr *SublistExpression) Evaluate(ctx *EvalContext) (Value, error)
func (SublistExpression) Tree ¶
func (expr SublistExpression) Tree() any
func (SublistExpression) Type ¶
func (SublistExpression) Type() ValueType
type UnarySubtractExpression ¶
type UnarySubtractExpression struct {
Expr Expression
}
func (*UnarySubtractExpression) Constraints ¶
func (expr *UnarySubtractExpression) Constraints(ctx *EvalContext) Constraint
func (*UnarySubtractExpression) Evaluate ¶
func (expr *UnarySubtractExpression) Evaluate(ctx *EvalContext) (Value, error)
func (UnarySubtractExpression) Tree ¶
func (expr UnarySubtractExpression) Tree() any
func (UnarySubtractExpression) Type ¶
func (expr UnarySubtractExpression) Type() ValueType
type Union ¶
type Union struct {
Stages []UnionStage
}
Computes the union of the resultsets of a sequence of queries
type UnionStage ¶
type UnionStage struct { IncludeAll bool Query *SingleQuery }
type UpdatingClause ¶
type UpdatingClause interface { Update(ctx *EvalContext, input Cursor) (Cursor, error) Tree() any // contains filtered or unexported methods }
func OC_Create ¶
func OC_Create(ctx *parser.OC_CreateContext) (UpdatingClause, error)
oC_Create : CREATE SP? oC_Pattern ;
func OC_Delete ¶
func OC_Delete(ctx *parser.OC_DeleteContext) (UpdatingClause, error)
oC_Delete : ( DETACH SP )? DELETE SP? oC_Expression ( SP? ',' SP? oC_Expression )* ;
func OC_Merge ¶
func OC_Merge(ctx *parser.OC_MergeContext) (UpdatingClause, error)
oC_Merge: MERGE SP? oC_PatternPart ( SP oC_MergeAction )* ;
func OC_Remove ¶
func OC_Remove(ctx *parser.OC_RemoveContext) (UpdatingClause, error)
oC_Remove : REMOVE SP oC_RemoveItem ( SP? ',' SP? oC_RemoveItem )* ;
func OC_Set ¶
func OC_Set(ctx *parser.OC_SetContext) (UpdatingClause, error)
oC_Set: SET SP? oC_SetItem ( SP? ',' SP? oC_SetItem )* ;
func OC_UpdatingClause ¶
func OC_UpdatingClause(ctx *parser.OC_UpdatingClauseContext) (UpdatingClause, error)
oC_UpdatingClause : oC_Create | oC_Merge | oC_Delete | oC_Set | oC_Remove ;
type Value ¶
type Value interface { Expression Get() any Const() bool }
func GetNamedColumn ¶
GetNamedColumn returns a column from the current row by name
type ValueConstraint ¶
type ValueConstraint struct {
Value Value
}
func (ValueConstraint) BuildFilter ¶
func (c ValueConstraint) BuildFilter(varName string) map[string]PropertyCriteria
func (ValueConstraint) CanInvert ¶
func (ValueConstraint) CanInvert() bool
func (ValueConstraint) Invert ¶
func (ValueConstraint) Invert() Constraint
type VarConstraint ¶
func (VarConstraint) BuildFilter ¶
func (c VarConstraint) BuildFilter(varName string) map[string]PropertyCriteria
func (VarConstraint) CanInvert ¶
func (VarConstraint) CanInvert() bool
func (VarConstraint) Invert ¶
func (VarConstraint) Invert() Constraint
type VariableAccessExpression ¶
type VariableAccessExpression struct {
Name string
}
func (*VariableAccessExpression) Constraints ¶
func (expr *VariableAccessExpression) Constraints(ctx *EvalContext) Constraint
func (*VariableAccessExpression) Evaluate ¶
func (expr *VariableAccessExpression) Evaluate(ctx *EvalContext) (Value, error)
func (VariableAccessExpression) Tree ¶
func (expr VariableAccessExpression) Tree() any
func (VariableAccessExpression) Type ¶
func (VariableAccessExpression) Type() ValueType
type With ¶
type With struct { Projection *ProjectionBody Where Expression }
type XorExpression ¶
type XorExpression struct {
Parts []Expression
}
func (*XorExpression) Constraints ¶
func (expr *XorExpression) Constraints(ctx *EvalContext) Constraint
func (*XorExpression) Evaluate ¶
func (expr *XorExpression) Evaluate(ctx *EvalContext) (Value, error)
func (XorExpression) Tree ¶
func (expr XorExpression) Tree() any
func (XorExpression) Type ¶
func (XorExpression) Type() ValueType
type YieldItem ¶
func OC_YieldItem ¶
func OC_YieldItem(ctx *parser.OC_YieldItemContext) YieldItem
oC_YieldItem:
( oC_ProcedureResultField SP AS SP )? oC_Variable ;
type YieldItems ¶
type YieldItems struct { All bool Items []YieldItem Where Expression }
func OC_YieldItems ¶
func OC_YieldItems(ctx *parser.OC_YieldItemsContext) (*YieldItems, error)
oC_YieldItems:
( '*' | ( oC_YieldItem ( SP? ',' SP? oC_YieldItem )* ) ) ( SP? oC_Where )? ;
func (YieldItems) Tree ¶
func (y YieldItems) Tree() any
Source Files
¶
- astexpression.go
- astliteral.go
- astpattern.go
- astprojection.go
- astquery.go
- astupdate.go
- constraints.go
- ctx.go
- cursor.go
- datefuncs.go
- datetime.go
- duration.go
- evalarithmetic.go
- evalexpression.go
- evallliteral.go
- evalpattern.go
- evalprojection.go
- evalquery.go
- evalupdate.go
- functions.go
- graph.go
- lang.go
- log.go
- lpg.go
- procedures.go
- scalarfuncs.go
- stringfuncs.go
- value.go