Documentation
¶
Overview ¶
Package cql provides a syntax parser for a "Context Query Language"
Index ¶
- func Compile(query string) (stmnt *Statement, err *ParseError)
- func EBNF() (ebnf string)
- func UnquoteRegexp(s string) (out string, err error)
- func UnquoteString(s string) (out string, err error)
- type Boolean
- type Condition
- type Expression
- type Nil
- type Operation
- type ParseError
- type Statement
- type Value
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func Compile ¶
func Compile(query string) (stmnt *Statement, err *ParseError)
func UnquoteRegexp ¶
func UnquoteString ¶
Types ¶
type Condition ¶
type Condition struct {
Left *Expression `parser:"'(' @@" json:"left"`
Type string `parser:"@( 'AND' | 'OR' )" json:"type"`
Right *Expression `parser:"@@ ')'" json:"right"`
}
type Expression ¶
type Expression struct {
Condition *Condition `parser:"( @@ )?" json:"condition,omitempty"`
Operation *Operation `parser:"( @@ )?" json:"operation,omitempty"`
}
func (*Expression) Render ¶
func (e *Expression) Render() (clone *Expression)
type Operation ¶
type ParseError ¶
type ParseError struct {
Query string
Column int
Message string
// contains filtered or unexported fields
}
func (*ParseError) Error ¶
func (e *ParseError) Error() (msg string)
func (*ParseError) Pretty ¶
func (e *ParseError) Pretty() (refined string)
type Statement ¶
type Statement struct {
Expression *Expression `parser:"@@" json:"expressions,omitempty"`
ContextKeys []string `parser:"" json:"context-keys,omitempty"`
// contains filtered or unexported fields
}
type Value ¶
type Value struct {
ContextKey *string `parser:" ( '.' @Ident )" json:"context-key,omitempty"`
Regexp *string `parser:"| ( 'm' @Regexp )" json:"regexp,omitempty"`
String *string `parser:"| ( @String )" json:"string,omitempty"`
Int *int `parser:"| ( @Int )" json:"int,omitempty"`
Float *float64 `parser:"| ( @Float )" json:"float,omitempty"`
Bool *Boolean `parser:"| @( 'true' | 'false' )" json:"bool,omitempty"`
Nil *Nil `parser:"| @( 'nil' )" json:"nil,omitempty"`
}
Click to show internal directories.
Click to hide internal directories.