Add search expression support to admin interface

This commit is contained in:
David Stotijn
2020-12-21 12:50:09 +01:00
parent 8ab65fb55f
commit 194d727f4f
11 changed files with 469 additions and 19 deletions

View File

@ -17,7 +17,7 @@ func TestParseQuery(t *testing.T) {
name: "empty query",
input: "",
expectedExpression: nil,
expectedError: errors.New("unexpected EOF"),
expectedError: errors.New("search: unexpected EOF"),
},
{
name: "string literal expression",
@ -199,6 +199,24 @@ func TestParseQuery(t *testing.T) {
},
expectedError: nil,
},
{
name: "eq operator takes precedence over boolean ops",
input: "foo=bar OR baz=yolo",
expectedExpression: &InfixExpression{
Operator: TokOpOr,
Left: &InfixExpression{
Operator: TokOpEq,
Left: &StringLiteral{Value: "foo"},
Right: &StringLiteral{Value: "bar"},
},
Right: &InfixExpression{
Operator: TokOpEq,
Left: &StringLiteral{Value: "baz"},
Right: &StringLiteral{Value: "yolo"},
},
},
expectedError: nil,
},
}
for _, tt := range tests {