velaql support indexing into exported array field (#5320)

Signed-off-by: hnd4r7 <307365651@qq.com>

Signed-off-by: hnd4r7 <307365651@qq.com>
This commit is contained in:
hnd4r7
2023-01-12 10:12:38 +08:00
committed by GitHub
parent 5136269c6f
commit cd5ef33951
2 changed files with 8 additions and 1 deletions
+1 -1
View File
@@ -37,7 +37,7 @@ type QueryView struct {
const (
// PatternQL is the pattern string of velaQL, velaQL's query syntax is `ViewName{key1=value1 ,key2="value2",}.Export`
PatternQL = `(?P<view>[a-z0-9](?:[a-z0-9\-]{0,61}[a-z0-9])?)(?P<parameter>{.*?})?\.?(?P<export>[_a-zA-Z][\._a-zA-Z0-9]*)?`
PatternQL = `(?P<view>[a-z0-9](?:[a-z0-9\-]{0,61}[a-z0-9])?)(?P<parameter>{.*?})?\.?(?P<export>[_a-zA-Z][\._a-zA-Z0-9\[\]]*)?`
// PatternKV is the pattern string of parameter
PatternKV = `(?P<key>[^=]+)=(?P<value>[^=]*?)(?:,|$)`
// KeyWordView represent view keyword
+7
View File
@@ -58,6 +58,13 @@ func TestParseVelaQL(t *testing.T) {
Export: "output.value.spec",
},
err: nil,
}, {
ql: `view{test=true}.output.value[0].spec`,
query: QueryView{
View: "view",
Export: "output.value[0].spec",
},
err: nil,
}}
for _, testcase := range testcases {