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: [013] 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: [001] [[002] [[005] [[006] [[007] title]], [005] [[006] [[007] userType], [008] eq, [023] "Employee"]]] <nil> [001] [[002] [[005] [[006] [[007] userType], [008] eq, [023] "Employee"], [009] [[006] [[007] emails], [011] [[005] [[006] [[007] type], [008] eq, [023] "work"], [005] [[006] [[007] value], [008] co, [023] "@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: [001] [[002] [[005] [[006] [[007] userType], [008] ne, [023] "Employee"], [003] [[001] [[002] [[005] [[006] [[007] emails], [008] co, [023] "example.com"]], [002] [[005] [[006] [[007] emails, [007] value], [008] co, [023] "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: [001] [[002] [[005] [[006] [[007] title]]], [002] [[005] [[006] [[007] userType], [008] eq, [023] "Intern"]]] <nil> [001] [[002] [[009] [[006] [[007] emails], [011] [[005] [[006] [[007] type], [008] eq, [023] "work"], [005] [[006] [[007] value], [008] co, [023] "@example.com"]]]], [002] [[009] [[006] [[007] ims], [011] [[005] [[006] [[007] type], [008] eq, [023] "xmpp"], [005] [[006] [[007] value], [008] co, [023] "@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: [001] [[002] [[005] [[006] [[007] userType], [008] eq, [023] "Employee"], [001] [[002] [[005] [[006] [[007] emails, [007] type], [008] eq, [023] "work"]]]]] <nil> [001] [[002] [[005] [[006] [[007] userType], [008] eq, [023] "Employee"], [001] [[002] [[005] [[006] [[007] emails], [008] co, [023] "example.com"]], [002] [[005] [[006] [[007] emails, [007] value], [008] co, [023] "example.org"]]]]] <nil>
func Number ¶
Example ¶
p, _ := ast.New([]byte("-10.0e+01"))
fmt.Println(Number(p))
Output: [016] [[017] -, [022] 10, [021] [[020] 0], [018] [[019] +, [020] 01]] <nil>
func Path ¶
Example ¶
p, _ := ast.New([]byte("members[value eq \"2819c223-7f76-453a-919d-413861904646\"].displayName"))
fmt.Println(Path(p))
Output: [004] [[009] [[006] [[007] members], [005] [[006] [[007] value], [008] eq, [023] "2819c223-7f76-453a-919d-413861904646"]], [007] displayName] <nil>
func String ¶
Example ¶
p, _ := ast.New([]byte("\"2819c223-7f76-453a-919d-413861904646\""))
fmt.Println(String(p))
Output: [023] "2819c223-7f76-453a-919d-413861904646" <nil>
Example (Complex) ¶
p, _ := ast.New([]byte("\"W/\\\"990-6468886345120203448\\\"\""))
fmt.Println(String(p))
Output: [023] "W/\"990-6468886345120203448\"" <nil>
Types ¶
This section is empty.
Click to show internal directories.
Click to hide internal directories.