Compare commits

...

5 Commits

Author SHA1 Message Date
Pijus Kamandulis 851b3ca3a8 Fix IN clause with function calls 2025-02-20 18:45:20 +02:00
Pijus Kamandulis d27c633e1d Better handling when passing null to string functions 2025-02-18 20:11:11 +02:00
Pijus Kamandulis 3987df89c0 Upgrade to golang 1.24.0 2025-02-18 19:16:21 +02:00
Pijus Kamandulis 6e3f4169a1 Fix 'ComparisonOperator' parsing 2025-02-18 19:12:08 +02:00
Pijus Kamandulis 14c5400d23 Keep old explorer images tagged with version 2025-02-09 22:42:51 +02:00
12 changed files with 556 additions and 279 deletions
@@ -15,7 +15,7 @@ jobs:
uses: crazy-max/ghaction-xgo@v3.1.0 uses: crazy-max/ghaction-xgo@v3.1.0
with: with:
xgo_version: latest xgo_version: latest
go_version: 1.22.0 go_version: 1.24.0
dest: dist dest: dist
pkg: sharedlibrary pkg: sharedlibrary
prefix: cosmium prefix: cosmium
+2 -2
View File
@@ -21,13 +21,13 @@ jobs:
- name: Set up Go - name: Set up Go
uses: actions/setup-go@v5 uses: actions/setup-go@v5
with: with:
go-version: 1.22.0 go-version: 1.24.0
- name: Cross-Compile with xgo - name: Cross-Compile with xgo
uses: crazy-max/ghaction-xgo@v3.1.0 uses: crazy-max/ghaction-xgo@v3.1.0
with: with:
xgo_version: latest xgo_version: latest
go_version: 1.22.0 go_version: 1.24.0
dest: sharedlibrary_dist dest: sharedlibrary_dist
pkg: sharedlibrary pkg: sharedlibrary
prefix: cosmium prefix: cosmium
+6
View File
@@ -135,6 +135,12 @@ docker_manifests:
- "ghcr.io/pikami/{{ .ProjectName }}:{{ .Version }}-explorer-amd64" - "ghcr.io/pikami/{{ .ProjectName }}:{{ .Version }}-explorer-amd64"
- "ghcr.io/pikami/{{ .ProjectName }}:{{ .Version }}-explorer-arm64" - "ghcr.io/pikami/{{ .ProjectName }}:{{ .Version }}-explorer-arm64"
- "ghcr.io/pikami/{{ .ProjectName }}:{{ .Version }}-explorer-arm64v8" - "ghcr.io/pikami/{{ .ProjectName }}:{{ .Version }}-explorer-arm64v8"
- name_template: 'ghcr.io/pikami/{{ .ProjectName }}:{{ .Version }}-explorer'
skip_push: auto
image_templates:
- "ghcr.io/pikami/{{ .ProjectName }}:{{ .Version }}-explorer-amd64"
- "ghcr.io/pikami/{{ .ProjectName }}:{{ .Version }}-explorer-arm64"
- "ghcr.io/pikami/{{ .ProjectName }}:{{ .Version }}-explorer-arm64v8"
checksum: checksum:
name_template: 'checksums.txt' name_template: 'checksums.txt'
+1 -1
View File
@@ -9,7 +9,7 @@ SERVER_LOCATION=./cmd/server
SHARED_LIB_LOCATION=./sharedlibrary SHARED_LIB_LOCATION=./sharedlibrary
SHARED_LIB_OPT=-buildmode=c-shared SHARED_LIB_OPT=-buildmode=c-shared
XGO_TARGETS=linux/amd64,linux/arm64,windows/amd64,windows/arm64,darwin/amd64,darwin/arm64 XGO_TARGETS=linux/amd64,linux/arm64,windows/amd64,windows/arm64,darwin/amd64,darwin/arm64
GOVERSION=1.22.0 GOVERSION=1.24.0
DIST_DIR=dist DIST_DIR=dist
+11 -11
View File
@@ -1,6 +1,6 @@
module github.com/pikami/cosmium module github.com/pikami/cosmium
go 1.22.0 go 1.24.0
require ( require (
github.com/Azure/azure-sdk-for-go/sdk/azcore v1.12.0 github.com/Azure/azure-sdk-for-go/sdk/azcore v1.12.0
@@ -9,13 +9,13 @@ require (
github.com/gin-gonic/gin v1.10.0 github.com/gin-gonic/gin v1.10.0
github.com/google/uuid v1.6.0 github.com/google/uuid v1.6.0
github.com/stretchr/testify v1.10.0 github.com/stretchr/testify v1.10.0
golang.org/x/exp v0.0.0-20250106191152-7588d65b2ba8 golang.org/x/exp v0.0.0-20250218142911-aa4b98e5adaa
) )
require ( require (
github.com/Azure/azure-sdk-for-go v68.0.0+incompatible // indirect github.com/Azure/azure-sdk-for-go v68.0.0+incompatible // indirect
github.com/Azure/azure-sdk-for-go/sdk/internal v1.10.0 // indirect github.com/Azure/azure-sdk-for-go/sdk/internal v1.10.0 // indirect
github.com/bytedance/sonic v1.12.7 // indirect github.com/bytedance/sonic v1.12.8 // indirect
github.com/bytedance/sonic/loader v0.2.3 // indirect github.com/bytedance/sonic/loader v0.2.3 // indirect
github.com/cloudwego/base64x v0.1.5 // indirect github.com/cloudwego/base64x v0.1.5 // indirect
github.com/davecgh/go-spew v1.1.1 // indirect github.com/davecgh/go-spew v1.1.1 // indirect
@@ -23,8 +23,8 @@ require (
github.com/gin-contrib/sse v1.0.0 // indirect github.com/gin-contrib/sse v1.0.0 // indirect
github.com/go-playground/locales v0.14.1 // indirect github.com/go-playground/locales v0.14.1 // indirect
github.com/go-playground/universal-translator v0.18.1 // indirect github.com/go-playground/universal-translator v0.18.1 // indirect
github.com/go-playground/validator/v10 v10.24.0 // indirect github.com/go-playground/validator/v10 v10.25.0 // indirect
github.com/goccy/go-json v0.10.4 // indirect github.com/goccy/go-json v0.10.5 // indirect
github.com/json-iterator/go v1.1.12 // indirect github.com/json-iterator/go v1.1.12 // indirect
github.com/klauspost/cpuid/v2 v2.2.9 // indirect github.com/klauspost/cpuid/v2 v2.2.9 // indirect
github.com/leodido/go-urn v1.4.0 // indirect github.com/leodido/go-urn v1.4.0 // indirect
@@ -36,11 +36,11 @@ require (
github.com/pmezard/go-difflib v1.0.0 // indirect github.com/pmezard/go-difflib v1.0.0 // indirect
github.com/twitchyliquid64/golang-asm v0.15.1 // indirect github.com/twitchyliquid64/golang-asm v0.15.1 // indirect
github.com/ugorji/go/codec v1.2.12 // indirect github.com/ugorji/go/codec v1.2.12 // indirect
golang.org/x/arch v0.13.0 // indirect golang.org/x/arch v0.14.0 // indirect
golang.org/x/crypto v0.32.0 // indirect golang.org/x/crypto v0.33.0 // indirect
golang.org/x/net v0.34.0 // indirect golang.org/x/net v0.35.0 // indirect
golang.org/x/sys v0.29.0 // indirect golang.org/x/sys v0.30.0 // indirect
golang.org/x/text v0.21.0 // indirect golang.org/x/text v0.22.0 // indirect
google.golang.org/protobuf v1.36.4 // indirect google.golang.org/protobuf v1.36.5 // indirect
gopkg.in/yaml.v3 v3.0.1 // indirect gopkg.in/yaml.v3 v3.0.1 // indirect
) )
+20 -20
View File
@@ -10,8 +10,8 @@ github.com/Azure/azure-sdk-for-go/sdk/internal v1.10.0 h1:ywEEhmNahHBihViHepv3xP
github.com/Azure/azure-sdk-for-go/sdk/internal v1.10.0/go.mod h1:iZDifYGJTIgIIkYRNWPENUnqx6bJ2xnSDFI2tjwZNuY= github.com/Azure/azure-sdk-for-go/sdk/internal v1.10.0/go.mod h1:iZDifYGJTIgIIkYRNWPENUnqx6bJ2xnSDFI2tjwZNuY=
github.com/AzureAD/microsoft-authentication-library-for-go v1.2.2 h1:XHOnouVk1mxXfQidrMEnLlPk9UMeRtyBTnEFtxkV0kU= github.com/AzureAD/microsoft-authentication-library-for-go v1.2.2 h1:XHOnouVk1mxXfQidrMEnLlPk9UMeRtyBTnEFtxkV0kU=
github.com/AzureAD/microsoft-authentication-library-for-go v1.2.2/go.mod h1:wP83P5OoQ5p6ip3ScPr0BAq0BvuPAvacpEuSzyouqAI= github.com/AzureAD/microsoft-authentication-library-for-go v1.2.2/go.mod h1:wP83P5OoQ5p6ip3ScPr0BAq0BvuPAvacpEuSzyouqAI=
github.com/bytedance/sonic v1.12.7 h1:CQU8pxOy9HToxhndH0Kx/S1qU/CuS9GnKYrGioDcU1Q= github.com/bytedance/sonic v1.12.8 h1:4xYRVRlXIgvSZ4e8iVTlMF5szgpXd4AfvuWgA8I8lgs=
github.com/bytedance/sonic v1.12.7/go.mod h1:tnbal4mxOMju17EGfknm2XyYcpyCnIROYOEYuemj13I= github.com/bytedance/sonic v1.12.8/go.mod h1:uVvFidNmlt9+wa31S1urfwwthTWteBgG0hWuoKAXTx8=
github.com/bytedance/sonic/loader v0.1.1/go.mod h1:ncP89zfokxS5LZrJxl5z0UJcsk4M4yY2JpfqGeCtNLU= github.com/bytedance/sonic/loader v0.1.1/go.mod h1:ncP89zfokxS5LZrJxl5z0UJcsk4M4yY2JpfqGeCtNLU=
github.com/bytedance/sonic/loader v0.2.3 h1:yctD0Q3v2NOGfSWPLPvG2ggA2kV6TS6s4wioyEqssH0= github.com/bytedance/sonic/loader v0.2.3 h1:yctD0Q3v2NOGfSWPLPvG2ggA2kV6TS6s4wioyEqssH0=
github.com/bytedance/sonic/loader v0.2.3/go.mod h1:N8A3vUdtUebEY2/VQC0MyhYeKUFosQU6FxH2JmUe6VI= github.com/bytedance/sonic/loader v0.2.3/go.mod h1:N8A3vUdtUebEY2/VQC0MyhYeKUFosQU6FxH2JmUe6VI=
@@ -35,10 +35,10 @@ github.com/go-playground/locales v0.14.1 h1:EWaQ/wswjilfKLTECiXz7Rh+3BjFhfDFKv/o
github.com/go-playground/locales v0.14.1/go.mod h1:hxrqLVvrK65+Rwrd5Fc6F2O76J/NuW9t0sjnWqG1slY= github.com/go-playground/locales v0.14.1/go.mod h1:hxrqLVvrK65+Rwrd5Fc6F2O76J/NuW9t0sjnWqG1slY=
github.com/go-playground/universal-translator v0.18.1 h1:Bcnm0ZwsGyWbCzImXv+pAJnYK9S473LQFuzCbDbfSFY= github.com/go-playground/universal-translator v0.18.1 h1:Bcnm0ZwsGyWbCzImXv+pAJnYK9S473LQFuzCbDbfSFY=
github.com/go-playground/universal-translator v0.18.1/go.mod h1:xekY+UJKNuX9WP91TpwSH2VMlDf28Uj24BCp08ZFTUY= github.com/go-playground/universal-translator v0.18.1/go.mod h1:xekY+UJKNuX9WP91TpwSH2VMlDf28Uj24BCp08ZFTUY=
github.com/go-playground/validator/v10 v10.24.0 h1:KHQckvo8G6hlWnrPX4NJJ+aBfWNAE/HH+qdL2cBpCmg= github.com/go-playground/validator/v10 v10.25.0 h1:5Dh7cjvzR7BRZadnsVOzPhWsrwUr0nmsZJxEAnFLNO8=
github.com/go-playground/validator/v10 v10.24.0/go.mod h1:GGzBIJMuE98Ic/kJsBXbz1x/7cByt++cQ+YOuDM5wus= github.com/go-playground/validator/v10 v10.25.0/go.mod h1:GGzBIJMuE98Ic/kJsBXbz1x/7cByt++cQ+YOuDM5wus=
github.com/goccy/go-json v0.10.4 h1:JSwxQzIqKfmFX1swYPpUThQZp/Ka4wzJdK0LWVytLPM= github.com/goccy/go-json v0.10.5 h1:Fq85nIqj+gXn/S5ahsiTlK3TmC85qgirsdTP/+DeaC4=
github.com/goccy/go-json v0.10.4/go.mod h1:oq7eo15ShAhp70Anwd5lgX2pLfOS3QCiwU/PULtXL6M= github.com/goccy/go-json v0.10.5/go.mod h1:oq7eo15ShAhp70Anwd5lgX2pLfOS3QCiwU/PULtXL6M=
github.com/golang-jwt/jwt v3.2.1+incompatible h1:73Z+4BJcrTC+KczS6WvTPvRGOp1WmfEP4Q1lOd9Z/+c= github.com/golang-jwt/jwt v3.2.1+incompatible h1:73Z+4BJcrTC+KczS6WvTPvRGOp1WmfEP4Q1lOd9Z/+c=
github.com/golang-jwt/jwt/v5 v5.2.1 h1:OuVbFODueb089Lh128TAcimifWaLhJwVflnrgM17wHk= github.com/golang-jwt/jwt/v5 v5.2.1 h1:OuVbFODueb089Lh128TAcimifWaLhJwVflnrgM17wHk=
github.com/golang-jwt/jwt/v5 v5.2.1/go.mod h1:pqrtFR0X4osieyHYxtmOUWsAWrfe1Q5UVIyoH402zdk= github.com/golang-jwt/jwt/v5 v5.2.1/go.mod h1:pqrtFR0X4osieyHYxtmOUWsAWrfe1Q5UVIyoH402zdk=
@@ -94,21 +94,21 @@ github.com/twitchyliquid64/golang-asm v0.15.1 h1:SU5vSMR7hnwNxj24w34ZyCi/FmDZTkS
github.com/twitchyliquid64/golang-asm v0.15.1/go.mod h1:a1lVb/DtPvCB8fslRZhAngC2+aY1QWCk3Cedj/Gdt08= github.com/twitchyliquid64/golang-asm v0.15.1/go.mod h1:a1lVb/DtPvCB8fslRZhAngC2+aY1QWCk3Cedj/Gdt08=
github.com/ugorji/go/codec v1.2.12 h1:9LC83zGrHhuUA9l16C9AHXAqEV/2wBQ4nkvumAE65EE= github.com/ugorji/go/codec v1.2.12 h1:9LC83zGrHhuUA9l16C9AHXAqEV/2wBQ4nkvumAE65EE=
github.com/ugorji/go/codec v1.2.12/go.mod h1:UNopzCgEMSXjBc6AOMqYvWC1ktqTAfzJZUZgYf6w6lg= github.com/ugorji/go/codec v1.2.12/go.mod h1:UNopzCgEMSXjBc6AOMqYvWC1ktqTAfzJZUZgYf6w6lg=
golang.org/x/arch v0.13.0 h1:KCkqVVV1kGg0X87TFysjCJ8MxtZEIU4Ja/yXGeoECdA= golang.org/x/arch v0.14.0 h1:z9JUEZWr8x4rR0OU6c4/4t6E6jOZ8/QBS2bBYBm4tx4=
golang.org/x/arch v0.13.0/go.mod h1:FEVrYAQjsQXMVJ1nsMoVVXPZg6p2JE2mx8psSWTDQys= golang.org/x/arch v0.14.0/go.mod h1:FEVrYAQjsQXMVJ1nsMoVVXPZg6p2JE2mx8psSWTDQys=
golang.org/x/crypto v0.32.0 h1:euUpcYgM8WcP71gNpTqQCn6rC2t6ULUPiOzfWaXVVfc= golang.org/x/crypto v0.33.0 h1:IOBPskki6Lysi0lo9qQvbxiQ+FvsCC/YWOecCHAixus=
golang.org/x/crypto v0.32.0/go.mod h1:ZnnJkOaASj8g0AjIduWNlq2NRxL0PlBrbKVyZ6V/Ugc= golang.org/x/crypto v0.33.0/go.mod h1:bVdXmD7IV/4GdElGPozy6U7lWdRXA4qyRVGJV57uQ5M=
golang.org/x/exp v0.0.0-20250106191152-7588d65b2ba8 h1:yqrTHse8TCMW1M1ZCP+VAR/l0kKxwaAIqN/il7x4voA= golang.org/x/exp v0.0.0-20250218142911-aa4b98e5adaa h1:t2QcU6V556bFjYgu4L6C+6VrCPyJZ+eyRsABUPs1mz4=
golang.org/x/exp v0.0.0-20250106191152-7588d65b2ba8/go.mod h1:tujkw807nyEEAamNbDrEGzRav+ilXA7PCRAd6xsmwiU= golang.org/x/exp v0.0.0-20250218142911-aa4b98e5adaa/go.mod h1:BHOTPb3L19zxehTsLoJXVaTktb06DFgmdW6Wb9s8jqk=
golang.org/x/net v0.34.0 h1:Mb7Mrk043xzHgnRM88suvJFwzVrRfHEHJEl5/71CKw0= golang.org/x/net v0.35.0 h1:T5GQRQb2y08kTAByq9L4/bz8cipCdA8FbRTXewonqY8=
golang.org/x/net v0.34.0/go.mod h1:di0qlW3YNM5oh6GqDGQr92MyTozJPmybPK4Ev/Gm31k= golang.org/x/net v0.35.0/go.mod h1:EglIi67kWsHKlRzzVMUD93VMSWGFOMSZgxFjparz1Qk=
golang.org/x/sys v0.6.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.6.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
golang.org/x/sys v0.29.0 h1:TPYlXGxvx1MGTn2GiZDhnjPA9wZzZeGKHHmKhHYvgaU= golang.org/x/sys v0.30.0 h1:QjkSwP/36a20jFYWkSue1YwXzLmsV5Gfq7Eiy72C1uc=
golang.org/x/sys v0.29.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA= golang.org/x/sys v0.30.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA=
golang.org/x/text v0.21.0 h1:zyQAAkrwaneQ066sspRyJaG9VNi/YJ1NfzcGB3hZ/qo= golang.org/x/text v0.22.0 h1:bofq7m3/HAFvbF51jz3Q9wLg3jkvSPuiZu/pD1XwgtM=
golang.org/x/text v0.21.0/go.mod h1:4IBbMaMmOPCJ8SecivzSH54+73PCFmPWxNTLm+vZkEQ= golang.org/x/text v0.22.0/go.mod h1:YRoo4H8PVmsu+E3Ou7cqLVH8oXWIHVoX0jqUWALQhfY=
google.golang.org/protobuf v1.36.4 h1:6A3ZDJHn/eNqc1i+IdefRzy/9PokBTPvcqMySR7NNIM= google.golang.org/protobuf v1.36.5 h1:tPhr+woSbjfYvY6/GPufUoYizxw1cF/yFoxJ2fmpwlM=
google.golang.org/protobuf v1.36.4/go.mod h1:9fA7Ob0pmnwhb644+1+CVWFRbNajQ6iRojtC/QF5bRE= google.golang.org/protobuf v1.36.5/go.mod h1:9fA7Ob0pmnwhb644+1+CVWFRbNajQ6iRojtC/QF5bRE=
gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0=
gopkg.in/check.v1 v1.0.0-20201130134442-10cb98267c6c h1:Hei/4ADfdWqJk1ZMxUNpqntNwaWcugrBjAiHlqqRiVk= gopkg.in/check.v1 v1.0.0-20201130134442-10cb98267c6c h1:Hei/4ADfdWqJk1ZMxUNpqntNwaWcugrBjAiHlqqRiVk=
gopkg.in/check.v1 v1.0.0-20201130134442-10cb98267c6c/go.mod h1:JHkPIbrfpd72SG/EVd6muEfDQjcINNoR0C8j2r3qZ4Q= gopkg.in/check.v1 v1.0.0-20201130134442-10cb98267c6c/go.mod h1:JHkPIbrfpd72SG/EVd6muEfDQjcINNoR0C8j2r3qZ4Q=
+32
View File
@@ -112,6 +112,38 @@ func Test_Parse(t *testing.T) {
) )
}) })
t.Run("Should parse IN function with function call", func(t *testing.T) {
testQueryParse(
t,
`Select c.id FROM c WHERE (ToString(c.id) IN ("123", "456"))`,
parsers.SelectStmt{
SelectItems: []parsers.SelectItem{
testutils.SelectItem_Path("c", "id"),
},
Table: parsers.Table{SelectItem: testutils.SelectItem_Path("c")},
Filters: parsers.SelectItem{
Type: parsers.SelectItemTypeFunctionCall,
Value: parsers.FunctionCall{
Type: parsers.FunctionCallIn,
Arguments: []interface{}{
parsers.SelectItem{
Type: parsers.SelectItemTypeFunctionCall,
Value: parsers.FunctionCall{
Type: parsers.FunctionCallToString,
Arguments: []interface{}{
testutils.SelectItem_Path("c", "id"),
},
},
},
testutils.SelectItem_Constant_String("123"),
testutils.SelectItem_Constant_String("456"),
},
},
},
},
)
})
t.Run("Should parse IN selector", func(t *testing.T) { t.Run("Should parse IN selector", func(t *testing.T) {
testQueryParse( testQueryParse(
t, t,
+356 -216
View File
@@ -2107,40 +2107,40 @@ var g = &grammar{
alternatives: []any{ alternatives: []any{
&litMatcher{ &litMatcher{
pos: position{line: 406, col: 24, offset: 11503}, pos: position{line: 406, col: 24, offset: 11503},
val: "=",
ignoreCase: false,
want: "\"=\"",
},
&litMatcher{
pos: position{line: 406, col: 30, offset: 11509},
val: "!=",
ignoreCase: false,
want: "\"!=\"",
},
&litMatcher{
pos: position{line: 406, col: 37, offset: 11516},
val: "<",
ignoreCase: false,
want: "\"<\"",
},
&litMatcher{
pos: position{line: 406, col: 43, offset: 11522},
val: "<=", val: "<=",
ignoreCase: false, ignoreCase: false,
want: "\"<=\"", want: "\"<=\"",
}, },
&litMatcher{ &litMatcher{
pos: position{line: 406, col: 50, offset: 11529}, pos: position{line: 406, col: 31, offset: 11510},
val: ">",
ignoreCase: false,
want: "\">\"",
},
&litMatcher{
pos: position{line: 406, col: 56, offset: 11535},
val: ">=", val: ">=",
ignoreCase: false, ignoreCase: false,
want: "\">=\"", want: "\">=\"",
}, },
&litMatcher{
pos: position{line: 406, col: 38, offset: 11517},
val: "=",
ignoreCase: false,
want: "\"=\"",
},
&litMatcher{
pos: position{line: 406, col: 44, offset: 11523},
val: "!=",
ignoreCase: false,
want: "\"!=\"",
},
&litMatcher{
pos: position{line: 406, col: 51, offset: 11530},
val: "<",
ignoreCase: false,
want: "\"<\"",
},
&litMatcher{
pos: position{line: 406, col: 57, offset: 11536},
val: ">",
ignoreCase: false,
want: "\">\"",
},
}, },
}, },
}, },
@@ -7203,97 +7203,217 @@ var g = &grammar{
{ {
name: "InFunction", name: "InFunction",
pos: position{line: 719, col: 1, offset: 27240}, pos: position{line: 719, col: 1, offset: 27240},
expr: &actionExpr{ expr: &choiceExpr{
pos: position{line: 719, col: 15, offset: 27254}, pos: position{line: 719, col: 15, offset: 27254},
run: (*parser).callonInFunction1, alternatives: []any{
expr: &seqExpr{ &actionExpr{
pos: position{line: 719, col: 15, offset: 27254}, pos: position{line: 719, col: 15, offset: 27254},
exprs: []any{ run: (*parser).callonInFunction2,
&labeledExpr{ expr: &seqExpr{
pos: position{line: 719, col: 15, offset: 27254}, pos: position{line: 719, col: 15, offset: 27254},
label: "ex1", exprs: []any{
expr: &ruleRefExpr{ &labeledExpr{
pos: position{line: 719, col: 19, offset: 27258}, pos: position{line: 719, col: 15, offset: 27254},
name: "SelectProperty", label: "ex1",
}, expr: &ruleRefExpr{
}, pos: position{line: 719, col: 19, offset: 27258},
&ruleRefExpr{ name: "SelectProperty",
pos: position{line: 719, col: 34, offset: 27273}, },
name: "ws", },
}, &ruleRefExpr{
&ruleRefExpr{ pos: position{line: 719, col: 34, offset: 27273},
pos: position{line: 719, col: 37, offset: 27276}, name: "ws",
name: "In", },
}, &ruleRefExpr{
&ruleRefExpr{ pos: position{line: 719, col: 37, offset: 27276},
pos: position{line: 719, col: 40, offset: 27279}, name: "In",
name: "ws", },
}, &ruleRefExpr{
&litMatcher{ pos: position{line: 719, col: 40, offset: 27279},
pos: position{line: 719, col: 43, offset: 27282}, name: "ws",
val: "(", },
ignoreCase: false, &litMatcher{
want: "\"(\"", pos: position{line: 719, col: 43, offset: 27282},
}, val: "(",
&ruleRefExpr{ ignoreCase: false,
pos: position{line: 719, col: 47, offset: 27286}, want: "\"(\"",
name: "ws", },
}, &ruleRefExpr{
&labeledExpr{ pos: position{line: 719, col: 47, offset: 27286},
pos: position{line: 719, col: 50, offset: 27289}, name: "ws",
label: "ex2", },
expr: &ruleRefExpr{ &labeledExpr{
pos: position{line: 719, col: 54, offset: 27293}, pos: position{line: 719, col: 50, offset: 27289},
name: "SelectItem", label: "ex2",
}, expr: &ruleRefExpr{
}, pos: position{line: 719, col: 54, offset: 27293},
&labeledExpr{ name: "SelectItem",
pos: position{line: 719, col: 65, offset: 27304}, },
label: "others", },
expr: &zeroOrMoreExpr{ &labeledExpr{
pos: position{line: 719, col: 72, offset: 27311}, pos: position{line: 719, col: 65, offset: 27304},
expr: &actionExpr{ label: "others",
pos: position{line: 719, col: 73, offset: 27312}, expr: &zeroOrMoreExpr{
run: (*parser).callonInFunction14, pos: position{line: 719, col: 72, offset: 27311},
expr: &seqExpr{ expr: &actionExpr{
pos: position{line: 719, col: 73, offset: 27312}, pos: position{line: 719, col: 73, offset: 27312},
exprs: []any{ run: (*parser).callonInFunction15,
&ruleRefExpr{ expr: &seqExpr{
pos: position{line: 719, col: 73, offset: 27312}, pos: position{line: 719, col: 73, offset: 27312},
name: "ws", exprs: []any{
}, &ruleRefExpr{
&litMatcher{ pos: position{line: 719, col: 73, offset: 27312},
pos: position{line: 719, col: 76, offset: 27315}, name: "ws",
val: ",", },
ignoreCase: false, &litMatcher{
want: "\",\"", pos: position{line: 719, col: 76, offset: 27315},
}, val: ",",
&ruleRefExpr{ ignoreCase: false,
pos: position{line: 719, col: 80, offset: 27319}, want: "\",\"",
name: "ws", },
}, &ruleRefExpr{
&labeledExpr{ pos: position{line: 719, col: 80, offset: 27319},
pos: position{line: 719, col: 83, offset: 27322}, name: "ws",
label: "ex", },
expr: &ruleRefExpr{ &labeledExpr{
pos: position{line: 719, col: 86, offset: 27325}, pos: position{line: 719, col: 83, offset: 27322},
name: "SelectItem", label: "ex",
expr: &ruleRefExpr{
pos: position{line: 719, col: 86, offset: 27325},
name: "SelectItem",
},
},
}, },
}, },
}, },
}, },
}, },
&ruleRefExpr{
pos: position{line: 719, col: 118, offset: 27357},
name: "ws",
},
&litMatcher{
pos: position{line: 719, col: 121, offset: 27360},
val: ")",
ignoreCase: false,
want: "\")\"",
},
}, },
}, },
&ruleRefExpr{ },
pos: position{line: 719, col: 118, offset: 27357}, &actionExpr{
name: "ws", pos: position{line: 721, col: 5, offset: 27484},
}, run: (*parser).callonInFunction24,
&litMatcher{ expr: &seqExpr{
pos: position{line: 719, col: 121, offset: 27360}, pos: position{line: 721, col: 5, offset: 27484},
val: ")", exprs: []any{
ignoreCase: false, &litMatcher{
want: "\")\"", pos: position{line: 721, col: 5, offset: 27484},
val: "(",
ignoreCase: false,
want: "\"(\"",
},
&ruleRefExpr{
pos: position{line: 721, col: 9, offset: 27488},
name: "ws",
},
&labeledExpr{
pos: position{line: 721, col: 12, offset: 27491},
label: "ex1",
expr: &ruleRefExpr{
pos: position{line: 721, col: 16, offset: 27495},
name: "SelectItem",
},
},
&ruleRefExpr{
pos: position{line: 721, col: 27, offset: 27506},
name: "ws",
},
&ruleRefExpr{
pos: position{line: 721, col: 30, offset: 27509},
name: "In",
},
&ruleRefExpr{
pos: position{line: 721, col: 33, offset: 27512},
name: "ws",
},
&litMatcher{
pos: position{line: 721, col: 36, offset: 27515},
val: "(",
ignoreCase: false,
want: "\"(\"",
},
&ruleRefExpr{
pos: position{line: 721, col: 40, offset: 27519},
name: "ws",
},
&labeledExpr{
pos: position{line: 721, col: 43, offset: 27522},
label: "ex2",
expr: &ruleRefExpr{
pos: position{line: 721, col: 47, offset: 27526},
name: "SelectItem",
},
},
&labeledExpr{
pos: position{line: 721, col: 58, offset: 27537},
label: "others",
expr: &zeroOrMoreExpr{
pos: position{line: 721, col: 65, offset: 27544},
expr: &actionExpr{
pos: position{line: 721, col: 66, offset: 27545},
run: (*parser).callonInFunction39,
expr: &seqExpr{
pos: position{line: 721, col: 66, offset: 27545},
exprs: []any{
&ruleRefExpr{
pos: position{line: 721, col: 66, offset: 27545},
name: "ws",
},
&litMatcher{
pos: position{line: 721, col: 69, offset: 27548},
val: ",",
ignoreCase: false,
want: "\",\"",
},
&ruleRefExpr{
pos: position{line: 721, col: 73, offset: 27552},
name: "ws",
},
&labeledExpr{
pos: position{line: 721, col: 76, offset: 27555},
label: "ex",
expr: &ruleRefExpr{
pos: position{line: 721, col: 79, offset: 27558},
name: "SelectItem",
},
},
},
},
},
},
},
&ruleRefExpr{
pos: position{line: 721, col: 111, offset: 27590},
name: "ws",
},
&litMatcher{
pos: position{line: 721, col: 114, offset: 27593},
val: ")",
ignoreCase: false,
want: "\")\"",
},
&ruleRefExpr{
pos: position{line: 721, col: 118, offset: 27597},
name: "ws",
},
&litMatcher{
pos: position{line: 721, col: 121, offset: 27600},
val: ")",
ignoreCase: false,
want: "\")\"",
},
},
}, },
}, },
}, },
@@ -7301,43 +7421,43 @@ var g = &grammar{
}, },
{ {
name: "AvgAggregateExpression", name: "AvgAggregateExpression",
pos: position{line: 723, col: 1, offset: 27483}, pos: position{line: 725, col: 1, offset: 27723},
expr: &actionExpr{ expr: &actionExpr{
pos: position{line: 723, col: 29, offset: 27511}, pos: position{line: 725, col: 29, offset: 27751},
run: (*parser).callonAvgAggregateExpression1, run: (*parser).callonAvgAggregateExpression1,
expr: &seqExpr{ expr: &seqExpr{
pos: position{line: 723, col: 29, offset: 27511}, pos: position{line: 725, col: 29, offset: 27751},
exprs: []any{ exprs: []any{
&litMatcher{ &litMatcher{
pos: position{line: 723, col: 29, offset: 27511}, pos: position{line: 725, col: 29, offset: 27751},
val: "avg", val: "avg",
ignoreCase: true, ignoreCase: true,
want: "\"AVG\"i", want: "\"AVG\"i",
}, },
&litMatcher{ &litMatcher{
pos: position{line: 723, col: 36, offset: 27518}, pos: position{line: 725, col: 36, offset: 27758},
val: "(", val: "(",
ignoreCase: false, ignoreCase: false,
want: "\"(\"", want: "\"(\"",
}, },
&ruleRefExpr{ &ruleRefExpr{
pos: position{line: 723, col: 40, offset: 27522}, pos: position{line: 725, col: 40, offset: 27762},
name: "ws", name: "ws",
}, },
&labeledExpr{ &labeledExpr{
pos: position{line: 723, col: 43, offset: 27525}, pos: position{line: 725, col: 43, offset: 27765},
label: "ex", label: "ex",
expr: &ruleRefExpr{ expr: &ruleRefExpr{
pos: position{line: 723, col: 46, offset: 27528}, pos: position{line: 725, col: 46, offset: 27768},
name: "SelectItem", name: "SelectItem",
}, },
}, },
&ruleRefExpr{ &ruleRefExpr{
pos: position{line: 723, col: 58, offset: 27540}, pos: position{line: 725, col: 58, offset: 27780},
name: "ws", name: "ws",
}, },
&litMatcher{ &litMatcher{
pos: position{line: 723, col: 61, offset: 27543}, pos: position{line: 725, col: 61, offset: 27783},
val: ")", val: ")",
ignoreCase: false, ignoreCase: false,
want: "\")\"", want: "\")\"",
@@ -7348,43 +7468,43 @@ var g = &grammar{
}, },
{ {
name: "CountAggregateExpression", name: "CountAggregateExpression",
pos: position{line: 727, col: 1, offset: 27635}, pos: position{line: 729, col: 1, offset: 27875},
expr: &actionExpr{ expr: &actionExpr{
pos: position{line: 727, col: 29, offset: 27663}, pos: position{line: 729, col: 29, offset: 27903},
run: (*parser).callonCountAggregateExpression1, run: (*parser).callonCountAggregateExpression1,
expr: &seqExpr{ expr: &seqExpr{
pos: position{line: 727, col: 29, offset: 27663}, pos: position{line: 729, col: 29, offset: 27903},
exprs: []any{ exprs: []any{
&litMatcher{ &litMatcher{
pos: position{line: 727, col: 29, offset: 27663}, pos: position{line: 729, col: 29, offset: 27903},
val: "count", val: "count",
ignoreCase: true, ignoreCase: true,
want: "\"COUNT\"i", want: "\"COUNT\"i",
}, },
&litMatcher{ &litMatcher{
pos: position{line: 727, col: 38, offset: 27672}, pos: position{line: 729, col: 38, offset: 27912},
val: "(", val: "(",
ignoreCase: false, ignoreCase: false,
want: "\"(\"", want: "\"(\"",
}, },
&ruleRefExpr{ &ruleRefExpr{
pos: position{line: 727, col: 42, offset: 27676}, pos: position{line: 729, col: 42, offset: 27916},
name: "ws", name: "ws",
}, },
&labeledExpr{ &labeledExpr{
pos: position{line: 727, col: 45, offset: 27679}, pos: position{line: 729, col: 45, offset: 27919},
label: "ex", label: "ex",
expr: &ruleRefExpr{ expr: &ruleRefExpr{
pos: position{line: 727, col: 48, offset: 27682}, pos: position{line: 729, col: 48, offset: 27922},
name: "SelectItem", name: "SelectItem",
}, },
}, },
&ruleRefExpr{ &ruleRefExpr{
pos: position{line: 727, col: 59, offset: 27693}, pos: position{line: 729, col: 59, offset: 27933},
name: "ws", name: "ws",
}, },
&litMatcher{ &litMatcher{
pos: position{line: 727, col: 62, offset: 27696}, pos: position{line: 729, col: 62, offset: 27936},
val: ")", val: ")",
ignoreCase: false, ignoreCase: false,
want: "\")\"", want: "\")\"",
@@ -7395,43 +7515,43 @@ var g = &grammar{
}, },
{ {
name: "MaxAggregateExpression", name: "MaxAggregateExpression",
pos: position{line: 731, col: 1, offset: 27790}, pos: position{line: 733, col: 1, offset: 28030},
expr: &actionExpr{ expr: &actionExpr{
pos: position{line: 731, col: 29, offset: 27818}, pos: position{line: 733, col: 29, offset: 28058},
run: (*parser).callonMaxAggregateExpression1, run: (*parser).callonMaxAggregateExpression1,
expr: &seqExpr{ expr: &seqExpr{
pos: position{line: 731, col: 29, offset: 27818}, pos: position{line: 733, col: 29, offset: 28058},
exprs: []any{ exprs: []any{
&litMatcher{ &litMatcher{
pos: position{line: 731, col: 29, offset: 27818}, pos: position{line: 733, col: 29, offset: 28058},
val: "max", val: "max",
ignoreCase: true, ignoreCase: true,
want: "\"MAX\"i", want: "\"MAX\"i",
}, },
&litMatcher{ &litMatcher{
pos: position{line: 731, col: 36, offset: 27825}, pos: position{line: 733, col: 36, offset: 28065},
val: "(", val: "(",
ignoreCase: false, ignoreCase: false,
want: "\"(\"", want: "\"(\"",
}, },
&ruleRefExpr{ &ruleRefExpr{
pos: position{line: 731, col: 40, offset: 27829}, pos: position{line: 733, col: 40, offset: 28069},
name: "ws", name: "ws",
}, },
&labeledExpr{ &labeledExpr{
pos: position{line: 731, col: 43, offset: 27832}, pos: position{line: 733, col: 43, offset: 28072},
label: "ex", label: "ex",
expr: &ruleRefExpr{ expr: &ruleRefExpr{
pos: position{line: 731, col: 46, offset: 27835}, pos: position{line: 733, col: 46, offset: 28075},
name: "SelectItem", name: "SelectItem",
}, },
}, },
&ruleRefExpr{ &ruleRefExpr{
pos: position{line: 731, col: 57, offset: 27846}, pos: position{line: 733, col: 57, offset: 28086},
name: "ws", name: "ws",
}, },
&litMatcher{ &litMatcher{
pos: position{line: 731, col: 60, offset: 27849}, pos: position{line: 733, col: 60, offset: 28089},
val: ")", val: ")",
ignoreCase: false, ignoreCase: false,
want: "\")\"", want: "\")\"",
@@ -7442,43 +7562,43 @@ var g = &grammar{
}, },
{ {
name: "MinAggregateExpression", name: "MinAggregateExpression",
pos: position{line: 735, col: 1, offset: 27941}, pos: position{line: 737, col: 1, offset: 28181},
expr: &actionExpr{ expr: &actionExpr{
pos: position{line: 735, col: 29, offset: 27969}, pos: position{line: 737, col: 29, offset: 28209},
run: (*parser).callonMinAggregateExpression1, run: (*parser).callonMinAggregateExpression1,
expr: &seqExpr{ expr: &seqExpr{
pos: position{line: 735, col: 29, offset: 27969}, pos: position{line: 737, col: 29, offset: 28209},
exprs: []any{ exprs: []any{
&litMatcher{ &litMatcher{
pos: position{line: 735, col: 29, offset: 27969}, pos: position{line: 737, col: 29, offset: 28209},
val: "min", val: "min",
ignoreCase: true, ignoreCase: true,
want: "\"MIN\"i", want: "\"MIN\"i",
}, },
&litMatcher{ &litMatcher{
pos: position{line: 735, col: 36, offset: 27976}, pos: position{line: 737, col: 36, offset: 28216},
val: "(", val: "(",
ignoreCase: false, ignoreCase: false,
want: "\"(\"", want: "\"(\"",
}, },
&ruleRefExpr{ &ruleRefExpr{
pos: position{line: 735, col: 40, offset: 27980}, pos: position{line: 737, col: 40, offset: 28220},
name: "ws", name: "ws",
}, },
&labeledExpr{ &labeledExpr{
pos: position{line: 735, col: 43, offset: 27983}, pos: position{line: 737, col: 43, offset: 28223},
label: "ex", label: "ex",
expr: &ruleRefExpr{ expr: &ruleRefExpr{
pos: position{line: 735, col: 46, offset: 27986}, pos: position{line: 737, col: 46, offset: 28226},
name: "SelectItem", name: "SelectItem",
}, },
}, },
&ruleRefExpr{ &ruleRefExpr{
pos: position{line: 735, col: 57, offset: 27997}, pos: position{line: 737, col: 57, offset: 28237},
name: "ws", name: "ws",
}, },
&litMatcher{ &litMatcher{
pos: position{line: 735, col: 60, offset: 28000}, pos: position{line: 737, col: 60, offset: 28240},
val: ")", val: ")",
ignoreCase: false, ignoreCase: false,
want: "\")\"", want: "\")\"",
@@ -7489,43 +7609,43 @@ var g = &grammar{
}, },
{ {
name: "SumAggregateExpression", name: "SumAggregateExpression",
pos: position{line: 739, col: 1, offset: 28092}, pos: position{line: 741, col: 1, offset: 28332},
expr: &actionExpr{ expr: &actionExpr{
pos: position{line: 739, col: 29, offset: 28120}, pos: position{line: 741, col: 29, offset: 28360},
run: (*parser).callonSumAggregateExpression1, run: (*parser).callonSumAggregateExpression1,
expr: &seqExpr{ expr: &seqExpr{
pos: position{line: 739, col: 29, offset: 28120}, pos: position{line: 741, col: 29, offset: 28360},
exprs: []any{ exprs: []any{
&litMatcher{ &litMatcher{
pos: position{line: 739, col: 29, offset: 28120}, pos: position{line: 741, col: 29, offset: 28360},
val: "sum", val: "sum",
ignoreCase: true, ignoreCase: true,
want: "\"SUM\"i", want: "\"SUM\"i",
}, },
&litMatcher{ &litMatcher{
pos: position{line: 739, col: 36, offset: 28127}, pos: position{line: 741, col: 36, offset: 28367},
val: "(", val: "(",
ignoreCase: false, ignoreCase: false,
want: "\"(\"", want: "\"(\"",
}, },
&ruleRefExpr{ &ruleRefExpr{
pos: position{line: 739, col: 40, offset: 28131}, pos: position{line: 741, col: 40, offset: 28371},
name: "ws", name: "ws",
}, },
&labeledExpr{ &labeledExpr{
pos: position{line: 739, col: 43, offset: 28134}, pos: position{line: 741, col: 43, offset: 28374},
label: "ex", label: "ex",
expr: &ruleRefExpr{ expr: &ruleRefExpr{
pos: position{line: 739, col: 46, offset: 28137}, pos: position{line: 741, col: 46, offset: 28377},
name: "SelectItem", name: "SelectItem",
}, },
}, },
&ruleRefExpr{ &ruleRefExpr{
pos: position{line: 739, col: 57, offset: 28148}, pos: position{line: 741, col: 57, offset: 28388},
name: "ws", name: "ws",
}, },
&litMatcher{ &litMatcher{
pos: position{line: 739, col: 60, offset: 28151}, pos: position{line: 741, col: 60, offset: 28391},
val: ")", val: ")",
ignoreCase: false, ignoreCase: false,
want: "\")\"", want: "\")\"",
@@ -7536,14 +7656,14 @@ var g = &grammar{
}, },
{ {
name: "Integer", name: "Integer",
pos: position{line: 743, col: 1, offset: 28243}, pos: position{line: 745, col: 1, offset: 28483},
expr: &actionExpr{ expr: &actionExpr{
pos: position{line: 743, col: 12, offset: 28254}, pos: position{line: 745, col: 12, offset: 28494},
run: (*parser).callonInteger1, run: (*parser).callonInteger1,
expr: &oneOrMoreExpr{ expr: &oneOrMoreExpr{
pos: position{line: 743, col: 12, offset: 28254}, pos: position{line: 745, col: 12, offset: 28494},
expr: &charClassMatcher{ expr: &charClassMatcher{
pos: position{line: 743, col: 12, offset: 28254}, pos: position{line: 745, col: 12, offset: 28494},
val: "[0-9]", val: "[0-9]",
ranges: []rune{'0', '9'}, ranges: []rune{'0', '9'},
ignoreCase: false, ignoreCase: false,
@@ -7554,29 +7674,29 @@ var g = &grammar{
}, },
{ {
name: "StringCharacter", name: "StringCharacter",
pos: position{line: 747, col: 1, offset: 28306}, pos: position{line: 749, col: 1, offset: 28546},
expr: &choiceExpr{ expr: &choiceExpr{
pos: position{line: 747, col: 20, offset: 28325}, pos: position{line: 749, col: 20, offset: 28565},
alternatives: []any{ alternatives: []any{
&actionExpr{ &actionExpr{
pos: position{line: 747, col: 20, offset: 28325}, pos: position{line: 749, col: 20, offset: 28565},
run: (*parser).callonStringCharacter2, run: (*parser).callonStringCharacter2,
expr: &seqExpr{ expr: &seqExpr{
pos: position{line: 747, col: 20, offset: 28325}, pos: position{line: 749, col: 20, offset: 28565},
exprs: []any{ exprs: []any{
&notExpr{ &notExpr{
pos: position{line: 747, col: 20, offset: 28325}, pos: position{line: 749, col: 20, offset: 28565},
expr: &choiceExpr{ expr: &choiceExpr{
pos: position{line: 747, col: 22, offset: 28327}, pos: position{line: 749, col: 22, offset: 28567},
alternatives: []any{ alternatives: []any{
&litMatcher{ &litMatcher{
pos: position{line: 747, col: 22, offset: 28327}, pos: position{line: 749, col: 22, offset: 28567},
val: "\"", val: "\"",
ignoreCase: false, ignoreCase: false,
want: "\"\\\"\"", want: "\"\\\"\"",
}, },
&litMatcher{ &litMatcher{
pos: position{line: 747, col: 28, offset: 28333}, pos: position{line: 749, col: 28, offset: 28573},
val: "\\", val: "\\",
ignoreCase: false, ignoreCase: false,
want: "\"\\\\\"", want: "\"\\\\\"",
@@ -7585,28 +7705,28 @@ var g = &grammar{
}, },
}, },
&anyMatcher{ &anyMatcher{
line: 747, col: 34, offset: 28339, line: 749, col: 34, offset: 28579,
}, },
}, },
}, },
}, },
&actionExpr{ &actionExpr{
pos: position{line: 748, col: 5, offset: 28376}, pos: position{line: 750, col: 5, offset: 28616},
run: (*parser).callonStringCharacter9, run: (*parser).callonStringCharacter9,
expr: &seqExpr{ expr: &seqExpr{
pos: position{line: 748, col: 5, offset: 28376}, pos: position{line: 750, col: 5, offset: 28616},
exprs: []any{ exprs: []any{
&litMatcher{ &litMatcher{
pos: position{line: 748, col: 5, offset: 28376}, pos: position{line: 750, col: 5, offset: 28616},
val: "\\", val: "\\",
ignoreCase: false, ignoreCase: false,
want: "\"\\\\\"", want: "\"\\\\\"",
}, },
&labeledExpr{ &labeledExpr{
pos: position{line: 748, col: 10, offset: 28381}, pos: position{line: 750, col: 10, offset: 28621},
label: "seq", label: "seq",
expr: &ruleRefExpr{ expr: &ruleRefExpr{
pos: position{line: 748, col: 14, offset: 28385}, pos: position{line: 750, col: 14, offset: 28625},
name: "EscapeSequenceCharacter", name: "EscapeSequenceCharacter",
}, },
}, },
@@ -7618,85 +7738,85 @@ var g = &grammar{
}, },
{ {
name: "EscapeSequenceCharacter", name: "EscapeSequenceCharacter",
pos: position{line: 750, col: 1, offset: 28430}, pos: position{line: 752, col: 1, offset: 28670},
expr: &labeledExpr{ expr: &labeledExpr{
pos: position{line: 750, col: 28, offset: 28457}, pos: position{line: 752, col: 28, offset: 28697},
label: "char", label: "char",
expr: &ruleRefExpr{ expr: &ruleRefExpr{
pos: position{line: 750, col: 33, offset: 28462}, pos: position{line: 752, col: 33, offset: 28702},
name: "EscapeCharacter", name: "EscapeCharacter",
}, },
}, },
}, },
{ {
name: "EscapeCharacter", name: "EscapeCharacter",
pos: position{line: 752, col: 1, offset: 28479}, pos: position{line: 754, col: 1, offset: 28719},
expr: &choiceExpr{ expr: &choiceExpr{
pos: position{line: 752, col: 20, offset: 28498}, pos: position{line: 754, col: 20, offset: 28738},
alternatives: []any{ alternatives: []any{
&litMatcher{ &litMatcher{
pos: position{line: 752, col: 20, offset: 28498}, pos: position{line: 754, col: 20, offset: 28738},
val: "'", val: "'",
ignoreCase: false, ignoreCase: false,
want: "\"'\"", want: "\"'\"",
}, },
&litMatcher{ &litMatcher{
pos: position{line: 753, col: 5, offset: 28506}, pos: position{line: 755, col: 5, offset: 28746},
val: "\"", val: "\"",
ignoreCase: false, ignoreCase: false,
want: "\"\\\"\"", want: "\"\\\"\"",
}, },
&litMatcher{ &litMatcher{
pos: position{line: 754, col: 5, offset: 28514}, pos: position{line: 756, col: 5, offset: 28754},
val: "\\", val: "\\",
ignoreCase: false, ignoreCase: false,
want: "\"\\\\\"", want: "\"\\\\\"",
}, },
&actionExpr{ &actionExpr{
pos: position{line: 755, col: 5, offset: 28523}, pos: position{line: 757, col: 5, offset: 28763},
run: (*parser).callonEscapeCharacter5, run: (*parser).callonEscapeCharacter5,
expr: &litMatcher{ expr: &litMatcher{
pos: position{line: 755, col: 5, offset: 28523}, pos: position{line: 757, col: 5, offset: 28763},
val: "b", val: "b",
ignoreCase: false, ignoreCase: false,
want: "\"b\"", want: "\"b\"",
}, },
}, },
&actionExpr{ &actionExpr{
pos: position{line: 756, col: 5, offset: 28552}, pos: position{line: 758, col: 5, offset: 28792},
run: (*parser).callonEscapeCharacter7, run: (*parser).callonEscapeCharacter7,
expr: &litMatcher{ expr: &litMatcher{
pos: position{line: 756, col: 5, offset: 28552}, pos: position{line: 758, col: 5, offset: 28792},
val: "f", val: "f",
ignoreCase: false, ignoreCase: false,
want: "\"f\"", want: "\"f\"",
}, },
}, },
&actionExpr{ &actionExpr{
pos: position{line: 757, col: 5, offset: 28581}, pos: position{line: 759, col: 5, offset: 28821},
run: (*parser).callonEscapeCharacter9, run: (*parser).callonEscapeCharacter9,
expr: &litMatcher{ expr: &litMatcher{
pos: position{line: 757, col: 5, offset: 28581}, pos: position{line: 759, col: 5, offset: 28821},
val: "n", val: "n",
ignoreCase: false, ignoreCase: false,
want: "\"n\"", want: "\"n\"",
}, },
}, },
&actionExpr{ &actionExpr{
pos: position{line: 758, col: 5, offset: 28610}, pos: position{line: 760, col: 5, offset: 28850},
run: (*parser).callonEscapeCharacter11, run: (*parser).callonEscapeCharacter11,
expr: &litMatcher{ expr: &litMatcher{
pos: position{line: 758, col: 5, offset: 28610}, pos: position{line: 760, col: 5, offset: 28850},
val: "r", val: "r",
ignoreCase: false, ignoreCase: false,
want: "\"r\"", want: "\"r\"",
}, },
}, },
&actionExpr{ &actionExpr{
pos: position{line: 759, col: 5, offset: 28639}, pos: position{line: 761, col: 5, offset: 28879},
run: (*parser).callonEscapeCharacter13, run: (*parser).callonEscapeCharacter13,
expr: &litMatcher{ expr: &litMatcher{
pos: position{line: 759, col: 5, offset: 28639}, pos: position{line: 761, col: 5, offset: 28879},
val: "t", val: "t",
ignoreCase: false, ignoreCase: false,
want: "\"t\"", want: "\"t\"",
@@ -7707,25 +7827,25 @@ var g = &grammar{
}, },
{ {
name: "non_escape_character", name: "non_escape_character",
pos: position{line: 761, col: 1, offset: 28665}, pos: position{line: 763, col: 1, offset: 28905},
expr: &actionExpr{ expr: &actionExpr{
pos: position{line: 761, col: 25, offset: 28689}, pos: position{line: 763, col: 25, offset: 28929},
run: (*parser).callonnon_escape_character1, run: (*parser).callonnon_escape_character1,
expr: &seqExpr{ expr: &seqExpr{
pos: position{line: 761, col: 25, offset: 28689}, pos: position{line: 763, col: 25, offset: 28929},
exprs: []any{ exprs: []any{
&notExpr{ &notExpr{
pos: position{line: 761, col: 25, offset: 28689}, pos: position{line: 763, col: 25, offset: 28929},
expr: &ruleRefExpr{ expr: &ruleRefExpr{
pos: position{line: 761, col: 27, offset: 28691}, pos: position{line: 763, col: 27, offset: 28931},
name: "escape_character", name: "escape_character",
}, },
}, },
&labeledExpr{ &labeledExpr{
pos: position{line: 761, col: 45, offset: 28709}, pos: position{line: 763, col: 45, offset: 28949},
label: "char", label: "char",
expr: &anyMatcher{ expr: &anyMatcher{
line: 761, col: 50, offset: 28714, line: 763, col: 50, offset: 28954,
}, },
}, },
}, },
@@ -7734,11 +7854,11 @@ var g = &grammar{
}, },
{ {
name: "ws", name: "ws",
pos: position{line: 764, col: 1, offset: 28753}, pos: position{line: 766, col: 1, offset: 28993},
expr: &zeroOrMoreExpr{ expr: &zeroOrMoreExpr{
pos: position{line: 764, col: 7, offset: 28759}, pos: position{line: 766, col: 7, offset: 28999},
expr: &charClassMatcher{ expr: &charClassMatcher{
pos: position{line: 764, col: 7, offset: 28759}, pos: position{line: 766, col: 7, offset: 28999},
val: "[ \\t\\n\\r]", val: "[ \\t\\n\\r]",
chars: []rune{' ', '\t', '\n', '\r'}, chars: []rune{' ', '\t', '\n', '\r'},
ignoreCase: false, ignoreCase: false,
@@ -7748,11 +7868,11 @@ var g = &grammar{
}, },
{ {
name: "wss", name: "wss",
pos: position{line: 766, col: 1, offset: 28771}, pos: position{line: 768, col: 1, offset: 29011},
expr: &oneOrMoreExpr{ expr: &oneOrMoreExpr{
pos: position{line: 766, col: 8, offset: 28778}, pos: position{line: 768, col: 8, offset: 29018},
expr: &charClassMatcher{ expr: &charClassMatcher{
pos: position{line: 766, col: 8, offset: 28778}, pos: position{line: 768, col: 8, offset: 29018},
val: "[ \\t\\n\\r]", val: "[ \\t\\n\\r]",
chars: []rune{' ', '\t', '\n', '\r'}, chars: []rune{' ', '\t', '\n', '\r'},
ignoreCase: false, ignoreCase: false,
@@ -7762,11 +7882,11 @@ var g = &grammar{
}, },
{ {
name: "EOF", name: "EOF",
pos: position{line: 768, col: 1, offset: 28790}, pos: position{line: 770, col: 1, offset: 29030},
expr: &notExpr{ expr: &notExpr{
pos: position{line: 768, col: 8, offset: 28797}, pos: position{line: 770, col: 8, offset: 29037},
expr: &anyMatcher{ expr: &anyMatcher{
line: 768, col: 9, offset: 28798, line: 770, col: 9, offset: 29038,
}, },
}, },
}, },
@@ -9232,24 +9352,44 @@ func (p *parser) callonMathRandExpression1() (any, error) {
return p.cur.onMathRandExpression1() return p.cur.onMathRandExpression1()
} }
func (c *current) onInFunction14(ex any) (any, error) { func (c *current) onInFunction15(ex any) (any, error) {
return ex, nil return ex, nil
} }
func (p *parser) callonInFunction14() (any, error) { func (p *parser) callonInFunction15() (any, error) {
stack := p.vstack[len(p.vstack)-1] stack := p.vstack[len(p.vstack)-1]
_ = stack _ = stack
return p.cur.onInFunction14(stack["ex"]) return p.cur.onInFunction15(stack["ex"])
} }
func (c *current) onInFunction1(ex1, ex2, others any) (any, error) { func (c *current) onInFunction2(ex1, ex2, others any) (any, error) {
return createFunctionCall(parsers.FunctionCallIn, append([]interface{}{ex1, ex2}, others.([]interface{})...)) return createFunctionCall(parsers.FunctionCallIn, append([]interface{}{ex1, ex2}, others.([]interface{})...))
} }
func (p *parser) callonInFunction1() (any, error) { func (p *parser) callonInFunction2() (any, error) {
stack := p.vstack[len(p.vstack)-1] stack := p.vstack[len(p.vstack)-1]
_ = stack _ = stack
return p.cur.onInFunction1(stack["ex1"], stack["ex2"], stack["others"]) return p.cur.onInFunction2(stack["ex1"], stack["ex2"], stack["others"])
}
func (c *current) onInFunction39(ex any) (any, error) {
return ex, nil
}
func (p *parser) callonInFunction39() (any, error) {
stack := p.vstack[len(p.vstack)-1]
_ = stack
return p.cur.onInFunction39(stack["ex"])
}
func (c *current) onInFunction24(ex1, ex2, others any) (any, error) {
return createFunctionCall(parsers.FunctionCallIn, append([]interface{}{ex1, ex2}, others.([]interface{})...))
}
func (p *parser) callonInFunction24() (any, error) {
stack := p.vstack[len(p.vstack)-1]
_ = stack
return p.cur.onInFunction24(stack["ex1"], stack["ex2"], stack["others"])
} }
func (c *current) onAvgAggregateExpression1(ex any) (any, error) { func (c *current) onAvgAggregateExpression1(ex any) (any, error) {
+3 -1
View File
@@ -403,7 +403,7 @@ OrderBy <- "ORDER"i ws "BY"i
Offset <- "OFFSET"i Offset <- "OFFSET"i
ComparisonOperator <- ("=" / "!=" / "<" / "<=" / ">" / ">=") { ComparisonOperator <- ("<=" / ">=" / "=" / "!=" / "<" / ">") {
return string(c.text), nil return string(c.text), nil
} }
@@ -718,6 +718,8 @@ MathRandExpression <- "RAND"i ws "(" ws ")" { return createFunctionCall(parsers.
InFunction <- ex1:SelectProperty ws In ws "(" ws ex2:SelectItem others:(ws "," ws ex:SelectItem { return ex, nil })* ws ")" { InFunction <- ex1:SelectProperty ws In ws "(" ws ex2:SelectItem others:(ws "," ws ex:SelectItem { return ex, nil })* ws ")" {
return createFunctionCall(parsers.FunctionCallIn, append([]interface{}{ex1, ex2}, others.([]interface{})...)) return createFunctionCall(parsers.FunctionCallIn, append([]interface{}{ex1, ex2}, others.([]interface{})...))
} / "(" ws ex1:SelectItem ws In ws "(" ws ex2:SelectItem others:(ws "," ws ex:SelectItem { return ex, nil })* ws ")" ws ")" {
return createFunctionCall(parsers.FunctionCallIn, append([]interface{}{ex1, ex2}, others.([]interface{})...))
} }
AvgAggregateExpression <- "AVG"i "(" ws ex:SelectItem ws ")" { AvgAggregateExpression <- "AVG"i "(" ws ex:SelectItem ws ")" {
+2 -2
View File
@@ -67,7 +67,7 @@ func Test_Parse_Were(t *testing.T) {
t, t,
`select c.id `select c.id
FROM c FROM c
WHERE c.isCool=true AND (c.id = "123" OR c.id = "456")`, WHERE c.isCool=true AND (c.id = "123" OR c.id <= "456")`,
parsers.SelectStmt{ parsers.SelectStmt{
SelectItems: []parsers.SelectItem{ SelectItems: []parsers.SelectItem{
{Path: []string{"c", "id"}}, {Path: []string{"c", "id"}},
@@ -90,7 +90,7 @@ func Test_Parse_Were(t *testing.T) {
Right: testutils.SelectItem_Constant_String("123"), Right: testutils.SelectItem_Constant_String("123"),
}, },
parsers.ComparisonExpression{ parsers.ComparisonExpression{
Operation: "=", Operation: "<=",
Left: parsers.SelectItem{Path: []string{"c", "id"}}, Left: parsers.SelectItem{Path: []string{"c", "id"}},
Right: testutils.SelectItem_Constant_String("456"), Right: testutils.SelectItem_Constant_String("456"),
}, },
@@ -126,6 +126,42 @@ func Test_Execute(t *testing.T) {
) )
}) })
t.Run("Should execute IN function with function call", func(t *testing.T) {
testQueryExecute(
t,
parsers.SelectStmt{
SelectItems: []parsers.SelectItem{
testutils.SelectItem_Path("c", "id"),
},
Table: parsers.Table{SelectItem: testutils.SelectItem_Path("c")},
Filters: parsers.SelectItem{
Type: parsers.SelectItemTypeFunctionCall,
Value: parsers.FunctionCall{
Type: parsers.FunctionCallIn,
Arguments: []interface{}{
parsers.SelectItem{
Type: parsers.SelectItemTypeFunctionCall,
Value: parsers.FunctionCall{
Type: parsers.FunctionCallToString,
Arguments: []interface{}{
testutils.SelectItem_Path("c", "id"),
},
},
},
testutils.SelectItem_Constant_String("123"),
testutils.SelectItem_Constant_String("456"),
},
},
},
},
mockData,
[]memoryexecutor.RowType{
map[string]interface{}{"id": "456"},
map[string]interface{}{"id": "123"},
},
)
})
t.Run("Should execute IN selector", func(t *testing.T) { t.Run("Should execute IN selector", func(t *testing.T) {
testQueryExecute( testQueryExecute(
t, t,
@@ -9,10 +9,14 @@ import (
) )
func (r rowContext) strings_StringEquals(arguments []interface{}) bool { func (r rowContext) strings_StringEquals(arguments []interface{}) bool {
str1 := r.parseString(arguments[0]) str1, str1ok := r.parseString(arguments[0])
str2 := r.parseString(arguments[1]) str2, str2ok := r.parseString(arguments[1])
ignoreCase := r.getBoolFlag(arguments) ignoreCase := r.getBoolFlag(arguments)
if !str1ok || !str2ok {
return false
}
if ignoreCase { if ignoreCase {
return strings.EqualFold(str1, str2) return strings.EqualFold(str1, str2)
} }
@@ -21,10 +25,14 @@ func (r rowContext) strings_StringEquals(arguments []interface{}) bool {
} }
func (r rowContext) strings_Contains(arguments []interface{}) bool { func (r rowContext) strings_Contains(arguments []interface{}) bool {
str1 := r.parseString(arguments[0]) str1, str1ok := r.parseString(arguments[0])
str2 := r.parseString(arguments[1]) str2, str2ok := r.parseString(arguments[1])
ignoreCase := r.getBoolFlag(arguments) ignoreCase := r.getBoolFlag(arguments)
if !str1ok || !str2ok {
return false
}
if ignoreCase { if ignoreCase {
str1 = strings.ToLower(str1) str1 = strings.ToLower(str1)
str2 = strings.ToLower(str2) str2 = strings.ToLower(str2)
@@ -34,10 +42,14 @@ func (r rowContext) strings_Contains(arguments []interface{}) bool {
} }
func (r rowContext) strings_EndsWith(arguments []interface{}) bool { func (r rowContext) strings_EndsWith(arguments []interface{}) bool {
str1 := r.parseString(arguments[0]) str1, str1ok := r.parseString(arguments[0])
str2 := r.parseString(arguments[1]) str2, str2ok := r.parseString(arguments[1])
ignoreCase := r.getBoolFlag(arguments) ignoreCase := r.getBoolFlag(arguments)
if !str1ok || !str2ok {
return false
}
if ignoreCase { if ignoreCase {
str1 = strings.ToLower(str1) str1 = strings.ToLower(str1)
str2 = strings.ToLower(str2) str2 = strings.ToLower(str2)
@@ -47,10 +59,14 @@ func (r rowContext) strings_EndsWith(arguments []interface{}) bool {
} }
func (r rowContext) strings_StartsWith(arguments []interface{}) bool { func (r rowContext) strings_StartsWith(arguments []interface{}) bool {
str1 := r.parseString(arguments[0]) str1, str1ok := r.parseString(arguments[0])
str2 := r.parseString(arguments[1]) str2, str2ok := r.parseString(arguments[1])
ignoreCase := r.getBoolFlag(arguments) ignoreCase := r.getBoolFlag(arguments)
if !str1ok || !str2ok {
return false
}
if ignoreCase { if ignoreCase {
str1 = strings.ToLower(str1) str1 = strings.ToLower(str1)
str2 = strings.ToLower(str2) str2 = strings.ToLower(str2)
@@ -73,8 +89,12 @@ func (r rowContext) strings_Concat(arguments []interface{}) string {
} }
func (r rowContext) strings_IndexOf(arguments []interface{}) int { func (r rowContext) strings_IndexOf(arguments []interface{}) int {
str1 := r.parseString(arguments[0]) str1, str1ok := r.parseString(arguments[0])
str2 := r.parseString(arguments[1]) str2, str2ok := r.parseString(arguments[1])
if !str1ok || !str2ok {
return -1
}
start := 0 start := 0
if len(arguments) > 2 && arguments[2] != nil { if len(arguments) > 2 && arguments[2] != nil {
@@ -115,9 +135,13 @@ func (r rowContext) strings_Lower(arguments []interface{}) string {
func (r rowContext) strings_Left(arguments []interface{}) string { func (r rowContext) strings_Left(arguments []interface{}) string {
var ok bool var ok bool
var length int var length int
str := r.parseString(arguments[0]) str, strOk := r.parseString(arguments[0])
lengthEx := r.resolveSelectItem(arguments[1].(parsers.SelectItem)) lengthEx := r.resolveSelectItem(arguments[1].(parsers.SelectItem))
if !strOk {
return ""
}
if length, ok = lengthEx.(int); !ok { if length, ok = lengthEx.(int); !ok {
logger.ErrorLn("strings_Left - got parameters of wrong type") logger.ErrorLn("strings_Left - got parameters of wrong type")
return "" return ""
@@ -135,28 +159,45 @@ func (r rowContext) strings_Left(arguments []interface{}) string {
} }
func (r rowContext) strings_Length(arguments []interface{}) int { func (r rowContext) strings_Length(arguments []interface{}) int {
str := r.parseString(arguments[0]) str, strOk := r.parseString(arguments[0])
if !strOk {
return 0
}
return len(str) return len(str)
} }
func (r rowContext) strings_LTrim(arguments []interface{}) string { func (r rowContext) strings_LTrim(arguments []interface{}) string {
str := r.parseString(arguments[0]) str, strOk := r.parseString(arguments[0])
if !strOk {
return ""
}
return strings.TrimLeft(str, " ") return strings.TrimLeft(str, " ")
} }
func (r rowContext) strings_Replace(arguments []interface{}) string { func (r rowContext) strings_Replace(arguments []interface{}) string {
str := r.parseString(arguments[0]) str, strOk := r.parseString(arguments[0])
oldStr := r.parseString(arguments[1]) oldStr, oldStrOk := r.parseString(arguments[1])
newStr := r.parseString(arguments[2]) newStr, newStrOk := r.parseString(arguments[2])
if !strOk || !oldStrOk || !newStrOk {
return ""
}
return strings.Replace(str, oldStr, newStr, -1) return strings.Replace(str, oldStr, newStr, -1)
} }
func (r rowContext) strings_Replicate(arguments []interface{}) string { func (r rowContext) strings_Replicate(arguments []interface{}) string {
var ok bool var ok bool
var times int var times int
str := r.parseString(arguments[0]) str, strOk := r.parseString(arguments[0])
timesEx := r.resolveSelectItem(arguments[1].(parsers.SelectItem)) timesEx := r.resolveSelectItem(arguments[1].(parsers.SelectItem))
if !strOk {
return ""
}
if times, ok = timesEx.(int); !ok { if times, ok = timesEx.(int); !ok {
logger.ErrorLn("strings_Replicate - got parameters of wrong type") logger.ErrorLn("strings_Replicate - got parameters of wrong type")
return "" return ""
@@ -174,9 +215,13 @@ func (r rowContext) strings_Replicate(arguments []interface{}) string {
} }
func (r rowContext) strings_Reverse(arguments []interface{}) string { func (r rowContext) strings_Reverse(arguments []interface{}) string {
str := r.parseString(arguments[0]) str, strOk := r.parseString(arguments[0])
runes := []rune(str) runes := []rune(str)
if !strOk {
return ""
}
for i, j := 0, len(runes)-1; i < j; i, j = i+1, j-1 { for i, j := 0, len(runes)-1; i < j; i, j = i+1, j-1 {
runes[i], runes[j] = runes[j], runes[i] runes[i], runes[j] = runes[j], runes[i]
} }
@@ -187,9 +232,13 @@ func (r rowContext) strings_Reverse(arguments []interface{}) string {
func (r rowContext) strings_Right(arguments []interface{}) string { func (r rowContext) strings_Right(arguments []interface{}) string {
var ok bool var ok bool
var length int var length int
str := r.parseString(arguments[0]) str, strOk := r.parseString(arguments[0])
lengthEx := r.resolveSelectItem(arguments[1].(parsers.SelectItem)) lengthEx := r.resolveSelectItem(arguments[1].(parsers.SelectItem))
if !strOk {
return ""
}
if length, ok = lengthEx.(int); !ok { if length, ok = lengthEx.(int); !ok {
logger.ErrorLn("strings_Right - got parameters of wrong type") logger.ErrorLn("strings_Right - got parameters of wrong type")
return "" return ""
@@ -207,7 +256,11 @@ func (r rowContext) strings_Right(arguments []interface{}) string {
} }
func (r rowContext) strings_RTrim(arguments []interface{}) string { func (r rowContext) strings_RTrim(arguments []interface{}) string {
str := r.parseString(arguments[0]) str, strOk := r.parseString(arguments[0])
if !strOk {
return ""
}
return strings.TrimRight(str, " ") return strings.TrimRight(str, " ")
} }
@@ -215,10 +268,14 @@ func (r rowContext) strings_Substring(arguments []interface{}) string {
var ok bool var ok bool
var startPos int var startPos int
var length int var length int
str := r.parseString(arguments[0]) str, strOk := r.parseString(arguments[0])
startPosEx := r.resolveSelectItem(arguments[1].(parsers.SelectItem)) startPosEx := r.resolveSelectItem(arguments[1].(parsers.SelectItem))
lengthEx := r.resolveSelectItem(arguments[2].(parsers.SelectItem)) lengthEx := r.resolveSelectItem(arguments[2].(parsers.SelectItem))
if !strOk {
return ""
}
if startPos, ok = startPosEx.(int); !ok { if startPos, ok = startPosEx.(int); !ok {
logger.ErrorLn("strings_Substring - got start parameters of wrong type") logger.ErrorLn("strings_Substring - got start parameters of wrong type")
return "" return ""
@@ -241,7 +298,11 @@ func (r rowContext) strings_Substring(arguments []interface{}) string {
} }
func (r rowContext) strings_Trim(arguments []interface{}) string { func (r rowContext) strings_Trim(arguments []interface{}) string {
str := r.parseString(arguments[0]) str, strOk := r.parseString(arguments[0])
if !strOk {
return ""
}
return strings.TrimSpace(str) return strings.TrimSpace(str)
} }
@@ -257,15 +318,15 @@ func (r rowContext) getBoolFlag(arguments []interface{}) bool {
return ignoreCase return ignoreCase
} }
func (r rowContext) parseString(argument interface{}) string { func (r rowContext) parseString(argument interface{}) (value string, ok bool) {
exItem := argument.(parsers.SelectItem) exItem := argument.(parsers.SelectItem)
ex := r.resolveSelectItem(exItem) ex := r.resolveSelectItem(exItem)
if str1, ok := ex.(string); ok { if str1, ok := ex.(string); ok {
return str1 return str1, true
} }
logger.ErrorLn("StringEquals got parameters of wrong type") logger.ErrorLn("StringEquals got parameters of wrong type")
return "" return "", false
} }
func convertToString(value interface{}) string { func convertToString(value interface{}) string {