mirror of
https://github.com/kevin-DL/services.git
synced 2026-01-14 03:54:47 +00:00
Db service fixes and improvements: dot access, truncate table etc (#157)
This commit is contained in:
@@ -8,6 +8,13 @@ import (
|
||||
"github.com/crufter/lexer"
|
||||
)
|
||||
|
||||
func TestCorrectFieldName(t *testing.T) {
|
||||
f := correctFieldName("a.b.c")
|
||||
if f != "data ->> 'a' ->> 'b' ->> 'c'" {
|
||||
t.Fatal(f)
|
||||
}
|
||||
}
|
||||
|
||||
func TestLexing(t *testing.T) {
|
||||
tokens, err := lexer.Lex("a == 12", expressions)
|
||||
if err != nil {
|
||||
@@ -55,6 +62,21 @@ func TestParsing(t *testing.T) {
|
||||
},
|
||||
},
|
||||
},
|
||||
tCase{
|
||||
Q: `a.b.c == 12 and name != "nandos"`,
|
||||
E: []Query{
|
||||
Query{
|
||||
Field: "a.b.c",
|
||||
Value: int64(12),
|
||||
Op: itemEquals,
|
||||
},
|
||||
Query{
|
||||
Field: "name",
|
||||
Value: "nandos",
|
||||
Op: itemNotEquals,
|
||||
},
|
||||
},
|
||||
},
|
||||
tCase{
|
||||
Q: `a == 12 and name != "nan'dos"`,
|
||||
E: []Query{
|
||||
|
||||
Reference in New Issue
Block a user