Documentation
¶
Index ¶
- Constants
- func Alpha(p *parser.Parser) (*parser.Cursor, bool)
- func AttrExp(p *ast.Parser) (*ast.Node, error)
- func AttrName(p *ast.Parser) (*ast.Node, error)
- func AttrPath(p *ast.Parser) (*ast.Node, error)
- func Character(p *ast.Parser) (*ast.Node, error)
- func CompareOp(p *ast.Parser) (*ast.Node, error)
- func CompareValue(p *ast.Parser) (*ast.Node, error)
- func Digit(p *parser.Parser) (*parser.Cursor, bool)
- func Digits(p *ast.Parser) (*ast.Node, error)
- func Escaped(p *ast.Parser) (*ast.Node, error)
- func Exp(p *ast.Parser) (*ast.Node, error)
- func False(p *ast.Parser) (*ast.Node, error)
- func Filter(p *ast.Parser) (*ast.Node, error)
- func FilterAnd(p *ast.Parser) (*ast.Node, error)
- func FilterNot(p *ast.Parser) (*ast.Node, error)
- func FilterOr(p *ast.Parser) (*ast.Node, error)
- func FilterParentheses(p *ast.Parser) (*ast.Node, error)
- func FilterValue(p *ast.Parser) (*ast.Node, error)
- func Frac(p *ast.Parser) (*ast.Node, error)
- func Int(p *ast.Parser) (*ast.Node, error)
- func Minus(p *ast.Parser) (*ast.Node, error)
- func NameChar(p *ast.Parser) (*ast.Node, error)
- func Null(p *ast.Parser) (*ast.Node, error)
- func Number(p *ast.Parser) (*ast.Node, error)
- func Path(p *ast.Parser) (*ast.Node, error)
- func Sign(p *ast.Parser) (*ast.Node, error)
- func String(p *ast.Parser) (*ast.Node, error)
- func SubAttr(p *ast.Parser) (*ast.Node, error)
- func True(p *ast.Parser) (*ast.Node, error)
- func URI(p *ast.Parser) (*ast.Node, error)
- func Unescaped(p *ast.Parser) (*ast.Node, error)
- func ValueFilter(p *ast.Parser) (*ast.Node, error)
- func ValueFilterAll(p *ast.Parser) (*ast.Node, error)
- func ValueFilterNot(p *ast.Parser) (*ast.Node, error)
- func ValueLogExpAnd(p *ast.Parser) (*ast.Node, error)
- func ValueLogExpOr(p *ast.Parser) (*ast.Node, error)
- func ValuePath(p *ast.Parser) (*ast.Node, error)
Examples ¶
Constants ¶
View Source
const (
SP = ' '
)
Variables ¶
This section is empty.
Functions ¶
func False ¶
Example ¶
p, _ := ast.New([]byte("FaLSe"))
fmt.Println(False(p))
Output: ["False","FaLSe"] <nil>
func FilterAnd ¶
Example ¶
p := func(s string) {
p, _ := ast.New([]byte(s))
fmt.Println(Filter(p))
}
p("title pr and userType eq \"Employee\"")
p("userType eq \"Employee\" and emails[type eq \"work\" and value co \"@example.com\"]")
Output: ["FilterOr",[["FilterAnd",[["AttrExp",[["AttrPath",[["AttrName","title"]]]]],["AttrExp",[["AttrPath",[["AttrName","userType"]]],["CompareOp","eq"],["String","\"Employee\""]]]]]]] <nil> ["FilterOr",[["FilterAnd",[["AttrExp",[["AttrPath",[["AttrName","userType"]]],["CompareOp","eq"],["String","\"Employee\""]]],["ValuePath",[["AttrPath",[["AttrName","emails"]]],["ValueLogExpAnd",[["AttrExp",[["AttrPath",[["AttrName","type"]]],["CompareOp","eq"],["String","\"work\""]]],["AttrExp",[["AttrPath",[["AttrName","value"]]],["CompareOp","co"],["String","\"@example.com\""]]]]]]]]]]] <nil>
func FilterNot ¶
Example ¶
p := func(s string) {
p, _ := ast.New([]byte(s))
fmt.Println(Filter(p))
}
p("userType ne \"Employee\" and not (emails co \"example.com\" or emails.value co \"example.org\")")
Output: ["FilterOr",[["FilterAnd",[["AttrExp",[["AttrPath",[["AttrName","userType"]]],["CompareOp","ne"],["String","\"Employee\""]]],["FilterNot",[["FilterOr",[["FilterAnd",[["AttrExp",[["AttrPath",[["AttrName","emails"]]],["CompareOp","co"],["String","\"example.com\""]]]]],["FilterAnd",[["AttrExp",[["AttrPath",[["AttrName","emails"],["AttrName","value"]]],["CompareOp","co"],["String","\"example.org\""]]]]]]]]]]]]] <nil>
func FilterOr ¶
Example ¶
p := func(s string) {
p, _ := ast.New([]byte(s))
fmt.Println(Filter(p))
}
p("title pr or userType eq \"Intern\"")
p("emails[type eq \"work\" and value co \"@example.com\"] or ims[type eq \"xmpp\" and value co \"@foo.com\"]")
Output: ["FilterOr",[["FilterAnd",[["AttrExp",[["AttrPath",[["AttrName","title"]]]]]]],["FilterAnd",[["AttrExp",[["AttrPath",[["AttrName","userType"]]],["CompareOp","eq"],["String","\"Intern\""]]]]]]] <nil> ["FilterOr",[["FilterAnd",[["ValuePath",[["AttrPath",[["AttrName","emails"]]],["ValueLogExpAnd",[["AttrExp",[["AttrPath",[["AttrName","type"]]],["CompareOp","eq"],["String","\"work\""]]],["AttrExp",[["AttrPath",[["AttrName","value"]]],["CompareOp","co"],["String","\"@example.com\""]]]]]]]]],["FilterAnd",[["ValuePath",[["AttrPath",[["AttrName","ims"]]],["ValueLogExpAnd",[["AttrExp",[["AttrPath",[["AttrName","type"]]],["CompareOp","eq"],["String","\"xmpp\""]]],["AttrExp",[["AttrPath",[["AttrName","value"]]],["CompareOp","co"],["String","\"@foo.com\""]]]]]]]]]]] <nil>
func FilterParentheses ¶
Example ¶
p := func(s string) {
p, _ := ast.New([]byte(s))
fmt.Println(Filter(p))
}
p("userType eq \"Employee\" and (emails.type eq \"work\")")
p("userType eq \"Employee\" and (emails co \"example.com\" or emails.value co \"example.org\")")
Output: ["FilterOr",[["FilterAnd",[["AttrExp",[["AttrPath",[["AttrName","userType"]]],["CompareOp","eq"],["String","\"Employee\""]]],["FilterOr",[["FilterAnd",[["AttrExp",[["AttrPath",[["AttrName","emails"],["AttrName","type"]]],["CompareOp","eq"],["String","\"work\""]]]]]]]]]]] <nil> ["FilterOr",[["FilterAnd",[["AttrExp",[["AttrPath",[["AttrName","userType"]]],["CompareOp","eq"],["String","\"Employee\""]]],["FilterOr",[["FilterAnd",[["AttrExp",[["AttrPath",[["AttrName","emails"]]],["CompareOp","co"],["String","\"example.com\""]]]]],["FilterAnd",[["AttrExp",[["AttrPath",[["AttrName","emails"],["AttrName","value"]]],["CompareOp","co"],["String","\"example.org\""]]]]]]]]]]] <nil>
func Number ¶
Example ¶
p, _ := ast.New([]byte("-10.0e+01"))
fmt.Println(Number(p))
Output: ["Number",[["Minus","-"],["Int","10"],["Frac",[["Digits","0"]]],["Exp",[["Sign","+"],["Digits","01"]]]]] <nil>
func Path ¶
Example ¶
p, _ := ast.New([]byte("members[value eq \"2819c223-7f76-453a-919d-413861904646\"].displayName"))
fmt.Println(Path(p))
Output: ["Path",[["ValuePath",[["AttrPath",[["AttrName","members"]]],["AttrExp",[["AttrPath",[["AttrName","value"]]],["CompareOp","eq"],["String","\"2819c223-7f76-453a-919d-413861904646\""]]]]],["AttrName","displayName"]]] <nil>
func String ¶
Example ¶
p, _ := ast.New([]byte("\"2819c223-7f76-453a-919d-413861904646\""))
fmt.Println(String(p))
Output: ["String","\"2819c223-7f76-453a-919d-413861904646\""] <nil>
Example (Complex) ¶
p, _ := ast.New([]byte("\"W/\\\"990-6468886345120203448\\\"\""))
fmt.Println(String(p))
Output: ["String","\"W/\\\"990-6468886345120203448\\\"\""] <nil>
func True ¶
Example ¶
p, _ := ast.New([]byte("TRue"))
fmt.Println(True(p))
Output: ["True","TRue"] <nil>
Types ¶
This section is empty.
Click to show internal directories.
Click to hide internal directories.