Documentation
¶
Index ¶
- func ScanBareIdent(r io.RuneScanner) string
- func ScanString(r io.RuneScanner) (string, error)
- type EdgeDirection
- type EdgePattern
- type Expr
- type MatchPattern
- type NodePattern
- type OrderBy
- type OrderDirection
- type ParseError
- type Parser
- func (p *Parser) ParseQuery() (q Query, err error)
- func (p *Parser) ParseSingleQuery() (*SingleQuery, error)
- func (p *Parser) Scan() (tok Token, pos Pos, lit string)
- func (p *Parser) ScanEdgePattern() (*EdgePattern, error)
- func (p *Parser) ScanExpression() (Expr, error)
- func (p *Parser) ScanIgnoreWhitespace() (tok Token, pos Pos, lit string)
- func (p *Parser) ScanMatchPattern() (*MatchPattern, error)
- func (p *Parser) ScanNodePattern() (*NodePattern, error)
- func (p *Parser) ScanPatternElements() (pe []PatternElement, err error)
- func (p *Parser) ScanProperties() (*map[string]Expr, error)
- func (p *Parser) ScanReadingClause() (*ReadingClause, error)
- func (p *Parser) Unscan()
- type PatternElement
- type Pos
- type Query
- type ReadingClause
- type Scanner
- type SingleQuery
- type StrLiteral
- type Symbol
- type Token
- type Variable
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func ScanBareIdent ¶
func ScanBareIdent(r io.RuneScanner) string
ScanBareIdent reads bare identifier from a rune reader.
func ScanString ¶
func ScanString(r io.RuneScanner) (string, error)
ScanString reads a quoted string from a rune reader.
Types ¶
type EdgeDirection ¶
type EdgeDirection int
EdgeDirection ...
const ( EdgeUndefined EdgeDirection = iota EdgeRight EdgeLeft EdgeOutgoing )
type EdgePattern ¶
type EdgePattern struct { Variable *string Labels []string Properties map[string]Expr MinHops *int MaxHops *int Direction EdgeDirection }
EdgePattern ...
func (EdgePattern) String ¶
func (ep EdgePattern) String() string
type Expr ¶
type Expr interface { String() string // contains filtered or unexported methods }
Expr ...
type MatchPattern ¶
type MatchPattern struct { Variable *Variable Elements []PatternElement }
MatchPattern ...
func (MatchPattern) String ¶
func (mp MatchPattern) String() string
type NodePattern ¶
NodePattern ...
func (NodePattern) String ¶
func (np NodePattern) String() string
type OrderDirection ¶
type OrderDirection int
OrderDirection ...
const ( // Ascending defines the ascending ordering. Ascending OrderDirection = iota // Descending defines the descending ordering. Descending )
type ParseError ¶
ParseError represents an error that occurred during parsing.
func (*ParseError) Error ¶
func (e *ParseError) Error() string
Error returns the string representation of the error.
type Parser ¶
type Parser struct {
// contains filtered or unexported fields
}
Parser represents a Cypher parser.
func (*Parser) ParseQuery ¶
ParseQuery parses a Cypher string and returns a Query AST object.
func (*Parser) ParseSingleQuery ¶
func (p *Parser) ParseSingleQuery() (*SingleQuery, error)
ParseSingleQuery ...
func (*Parser) ScanEdgePattern ¶
func (p *Parser) ScanEdgePattern() (*EdgePattern, error)
ScanEdgePattern returns an EdgePattern if possible to consume a complete valid edge.
func (*Parser) ScanIgnoreWhitespace ¶
ScanIgnoreWhitespace scans the next non-whitespace and non-comment token.
func (*Parser) ScanMatchPattern ¶
func (p *Parser) ScanMatchPattern() (*MatchPattern, error)
ScanMatchPattern ...
func (*Parser) ScanNodePattern ¶
func (p *Parser) ScanNodePattern() (*NodePattern, error)
ScanNodePattern returns a NodePattern if possible to consume a complete valid node.
func (*Parser) ScanPatternElements ¶
func (p *Parser) ScanPatternElements() (pe []PatternElement, err error)
ScanPatternElements ...
func (*Parser) ScanProperties ¶
ScanProperties ...
func (*Parser) ScanReadingClause ¶
func (p *Parser) ScanReadingClause() (*ReadingClause, error)
ScanReadingClause ...
type PatternElement ¶
type PatternElement interface { String() string // contains filtered or unexported methods }
PatternElement ...
type Pos ¶
Pos specifies the line and character position of a token. The Char and Line are both zero-based indexes.
type Query ¶
type Query struct {
Root *SingleQuery
}
Query represents the Cypher query root element.
func ParseQuery ¶
ParseQuery parses a query string and returns its AST representation.
type ReadingClause ¶
type ReadingClause struct { OptionalMatch bool Pattern []MatchPattern Where *Expr }
ReadingClause ...
func (ReadingClause) String ¶
func (rc ReadingClause) String() string
type Scanner ¶
type Scanner struct {
// contains filtered or unexported fields
}
Scanner is a lexical scanner.
func NewScanner ¶
NewScanner returns a new instance of Scanner.
type SingleQuery ¶
type SingleQuery struct { Reading []ReadingClause Distinct bool ReturnItems []Expr Order []OrderBy Skip *Expr Limit *Expr }
SingleQuery ...
func (SingleQuery) String ¶
func (sq SingleQuery) String() string
type StrLiteral ¶
type StrLiteral string
StrLiteral ...
func (StrLiteral) String ¶
func (s StrLiteral) String() string
type Token ¶
type Token int
Token is a lexical token of the Cypher language.
const ( // ILLEGAL Token, EOF, WS are Special Cypher tokens. ILLEGAL Token = iota EOF WS COMMENT // IDENT and the following are literal tokens. IDENT // main NUMBER // 12345.67 INTEGER // 12345 STRING // "abc" BADSTRING // "abc BADESCAPE // "\q TRUE // true FALSE // false NULL // null PLUS // + SUB // - MUL // * DIV // / MOD // % POW // ^ EQ // = NEQ // <> LT // < LTE // <= GT // > GTE // >= INC // += BAR // | AND // AND OR // OR XOR // XOR NOT // NOT LPAREN // ( RPAREN // ) LBRACE // { RBRACE // } LBRACKET // [ RBRACKET // ] COMMA // , COLON // : SEMICOLON // ; DOT // . DOUBLEDOT // .. // ALL and the following are Cypher Keywords ADD ALL AS ASC ASCENDING BY CASE CONSTRAINT CONTAINS CREATE DELETE DESC DESCENDING DETACH DISTINCT DO DROP ELSE END ENDS EXISTS FOR IN IS LIMIT MANDATORY MATCH MERGE OF ON OPTIONAL ORDER REMOVE REQUIRE RETURN SCALAR SET SKIP STARTS THEN UNION UNIQUE UNWIND WHEN WHERE WITH )