mirror of
https://github.com/pikami/cosmium.git
synced 2026-01-12 22:15:36 +00:00
Compare commits
4 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
d64bdeb385 | ||
|
|
11f3a1ad01 | ||
|
|
4d67212f1b | ||
|
|
03cd04e996 |
@@ -15,7 +15,7 @@ jobs:
|
||||
uses: crazy-max/ghaction-xgo@e22d3c8b089adba750d5a74738b8e95d96f0c991 # v3.1.0
|
||||
with:
|
||||
xgo_version: latest
|
||||
go_version: 1.25.1
|
||||
go_version: 1.24.7
|
||||
dest: dist
|
||||
pkg: sharedlibrary
|
||||
prefix: cosmium
|
||||
|
||||
4
.github/workflows/release.yml
vendored
4
.github/workflows/release.yml
vendored
@@ -21,13 +21,13 @@ jobs:
|
||||
- name: Set up Go
|
||||
uses: actions/setup-go@v5
|
||||
with:
|
||||
go-version: 1.25.1
|
||||
go-version: 1.24.7
|
||||
|
||||
- name: Cross-Compile with xgo
|
||||
uses: crazy-max/ghaction-xgo@e22d3c8b089adba750d5a74738b8e95d96f0c991 # v3.1.0
|
||||
with:
|
||||
xgo_version: latest
|
||||
go_version: 1.25.1
|
||||
go_version: 1.24.7
|
||||
dest: sharedlibrary_dist
|
||||
pkg: sharedlibrary
|
||||
prefix: cosmium
|
||||
|
||||
2
Makefile
2
Makefile
@@ -9,7 +9,7 @@ SERVER_LOCATION=./cmd/server
|
||||
SHARED_LIB_LOCATION=./sharedlibrary
|
||||
SHARED_LIB_OPT=-buildmode=c-shared
|
||||
XGO_TARGETS=linux/amd64,linux/arm64,windows/amd64,windows/arm64,darwin/amd64,darwin/arm64
|
||||
GOVERSION=1.25.1
|
||||
GOVERSION=1.24.7
|
||||
|
||||
DIST_DIR=dist
|
||||
|
||||
|
||||
@@ -121,5 +121,26 @@ func Test_Collections(t *testing.T) {
|
||||
panic(err)
|
||||
}
|
||||
})
|
||||
|
||||
t.Run("Should delete collection with exactly matching name", func(t *testing.T) {
|
||||
ts.DataStore.CreateCollection(testDatabaseName, datastore.Collection{
|
||||
ID: testCollectionName + "extra",
|
||||
})
|
||||
ts.DataStore.CreateCollection(testDatabaseName, datastore.Collection{
|
||||
ID: testCollectionName,
|
||||
})
|
||||
|
||||
collectionResponse, err := databaseClient.NewContainer(testCollectionName)
|
||||
assert.Nil(t, err)
|
||||
|
||||
readResponse, err := collectionResponse.Delete(context.TODO(), &azcosmos.DeleteContainerOptions{})
|
||||
assert.Nil(t, err)
|
||||
assert.Equal(t, readResponse.RawResponse.StatusCode, http.StatusNoContent)
|
||||
|
||||
collections, status := ts.DataStore.GetAllCollections(testDatabaseName)
|
||||
assert.Equal(t, status, datastore.StatusOk)
|
||||
assert.Len(t, collections, 1)
|
||||
assert.Equal(t, collections[0].ID, testCollectionName+"extra")
|
||||
})
|
||||
})
|
||||
}
|
||||
|
||||
@@ -109,5 +109,26 @@ func Test_Databases(t *testing.T) {
|
||||
panic(err)
|
||||
}
|
||||
})
|
||||
|
||||
t.Run("Should delete database with exactly matching name", func(t *testing.T) {
|
||||
ts.DataStore.CreateDatabase(datastore.Database{
|
||||
ID: testDatabaseName + "extra",
|
||||
})
|
||||
ts.DataStore.CreateDatabase(datastore.Database{
|
||||
ID: testDatabaseName,
|
||||
})
|
||||
|
||||
databaseResponse, err := client.NewDatabase(testDatabaseName)
|
||||
assert.Nil(t, err)
|
||||
|
||||
readResponse, err := databaseResponse.Delete(context.TODO(), &azcosmos.DeleteDatabaseOptions{})
|
||||
assert.Nil(t, err)
|
||||
assert.Equal(t, readResponse.RawResponse.StatusCode, http.StatusNoContent)
|
||||
|
||||
dbs, status := ts.DataStore.GetAllDatabases()
|
||||
assert.Equal(t, status, datastore.StatusOk)
|
||||
assert.Len(t, dbs, 1)
|
||||
assert.Equal(t, dbs[0].ID, testDatabaseName+"extra")
|
||||
})
|
||||
})
|
||||
}
|
||||
|
||||
@@ -425,7 +425,7 @@ func Test_Documents(t *testing.T) {
|
||||
assert.Equal(t, int32(http.StatusNoContent), operationResponse.StatusCode)
|
||||
|
||||
_, status := ts.DataStore.GetDocument(testDatabaseName, testCollectionName, "12345")
|
||||
assert.Equal(t, datastore.StatusNotFound, int(status))
|
||||
assert.Equal(t, datastore.StatusNotFound, status)
|
||||
})
|
||||
|
||||
t.Run("Should execute REPLACE transactional batch", func(t *testing.T) {
|
||||
|
||||
29
go.mod
29
go.mod
@@ -1,17 +1,17 @@
|
||||
module github.com/pikami/cosmium
|
||||
|
||||
go 1.25.1
|
||||
go 1.24.7
|
||||
|
||||
require (
|
||||
github.com/Azure/azure-sdk-for-go/sdk/azcore v1.19.1
|
||||
github.com/Azure/azure-sdk-for-go/sdk/data/azcosmos v1.4.1
|
||||
github.com/cosmiumdev/json-patch/v5 v5.9.11
|
||||
github.com/dgraph-io/badger/v4 v4.8.0
|
||||
github.com/gin-gonic/gin v1.10.1
|
||||
github.com/gin-gonic/gin v1.11.0
|
||||
github.com/google/uuid v1.6.0
|
||||
github.com/stretchr/testify v1.11.1
|
||||
github.com/vmihailenco/msgpack/v5 v5.4.1
|
||||
golang.org/x/exp v0.0.0-20250911091902-df9299821621
|
||||
golang.org/x/exp v0.0.0-20251002181428-27f1f14c8bb9
|
||||
)
|
||||
|
||||
require (
|
||||
@@ -31,9 +31,10 @@ require (
|
||||
github.com/go-logr/stdr v1.2.2 // indirect
|
||||
github.com/go-playground/locales v0.14.1 // indirect
|
||||
github.com/go-playground/universal-translator v0.18.1 // indirect
|
||||
github.com/go-playground/validator/v10 v10.27.0 // indirect
|
||||
github.com/go-playground/validator/v10 v10.28.0 // indirect
|
||||
github.com/goccy/go-json v0.10.5 // indirect
|
||||
github.com/google/flatbuffers v25.2.10+incompatible // indirect
|
||||
github.com/goccy/go-yaml v1.18.0 // indirect
|
||||
github.com/google/flatbuffers v25.9.23+incompatible // indirect
|
||||
github.com/json-iterator/go v1.1.12 // indirect
|
||||
github.com/klauspost/compress v1.18.0 // indirect
|
||||
github.com/klauspost/cpuid/v2 v2.3.0 // indirect
|
||||
@@ -43,6 +44,8 @@ require (
|
||||
github.com/modern-go/reflect2 v1.0.2 // indirect
|
||||
github.com/pelletier/go-toml/v2 v2.2.4 // indirect
|
||||
github.com/pmezard/go-difflib v1.0.0 // indirect
|
||||
github.com/quic-go/qpack v0.5.1 // indirect
|
||||
github.com/quic-go/quic-go v0.55.0 // indirect
|
||||
github.com/twitchyliquid64/golang-asm v0.15.1 // indirect
|
||||
github.com/ugorji/go/codec v1.3.0 // indirect
|
||||
github.com/vmihailenco/tagparser/v2 v2.0.0 // indirect
|
||||
@@ -50,11 +53,15 @@ require (
|
||||
go.opentelemetry.io/otel v1.38.0 // indirect
|
||||
go.opentelemetry.io/otel/metric v1.38.0 // indirect
|
||||
go.opentelemetry.io/otel/trace v1.38.0 // indirect
|
||||
golang.org/x/arch v0.21.0 // indirect
|
||||
golang.org/x/crypto v0.42.0 // indirect
|
||||
golang.org/x/net v0.44.0 // indirect
|
||||
golang.org/x/sys v0.36.0 // indirect
|
||||
golang.org/x/text v0.29.0 // indirect
|
||||
google.golang.org/protobuf v1.36.9 // indirect
|
||||
go.uber.org/mock v0.6.0 // indirect
|
||||
golang.org/x/arch v0.22.0 // indirect
|
||||
golang.org/x/crypto v0.43.0 // indirect
|
||||
golang.org/x/mod v0.29.0 // indirect
|
||||
golang.org/x/net v0.45.0 // indirect
|
||||
golang.org/x/sync v0.17.0 // indirect
|
||||
golang.org/x/sys v0.37.0 // indirect
|
||||
golang.org/x/text v0.30.0 // indirect
|
||||
golang.org/x/tools v0.37.0 // indirect
|
||||
google.golang.org/protobuf v1.36.10 // indirect
|
||||
gopkg.in/yaml.v3 v3.0.1 // indirect
|
||||
)
|
||||
|
||||
54
go.sum
54
go.sum
@@ -37,8 +37,8 @@ github.com/gabriel-vasile/mimetype v1.4.10 h1:zyueNbySn/z8mJZHLt6IPw0KoZsiQNszIp
|
||||
github.com/gabriel-vasile/mimetype v1.4.10/go.mod h1:d+9Oxyo1wTzWdyVUPMmXFvp4F9tea18J8ufA774AB3s=
|
||||
github.com/gin-contrib/sse v1.1.0 h1:n0w2GMuUpWDVp7qSpvze6fAu9iRxJY4Hmj6AmBOU05w=
|
||||
github.com/gin-contrib/sse v1.1.0/go.mod h1:hxRZ5gVpWMT7Z0B0gSNYqqsSCNIJMjzvm6fqCz9vjwM=
|
||||
github.com/gin-gonic/gin v1.10.1 h1:T0ujvqyCSqRopADpgPgiTT63DUQVSfojyME59Ei63pQ=
|
||||
github.com/gin-gonic/gin v1.10.1/go.mod h1:4PMNQiOhvDRa013RKVbsiNwoyezlm2rm0uX/T7kzp5Y=
|
||||
github.com/gin-gonic/gin v1.11.0 h1:OW/6PLjyusp2PPXtyxKHU0RbX6I/l28FTdDlae5ueWk=
|
||||
github.com/gin-gonic/gin v1.11.0/go.mod h1:+iq/FyxlGzII0KHiBGjuNn4UNENUlKbGlNmc+W50Dls=
|
||||
github.com/go-logr/logr v1.2.2/go.mod h1:jdQByPbusPIv2/zmleS9BjJVeZ6kBagPoEUsqbVz/1A=
|
||||
github.com/go-logr/logr v1.4.3 h1:CjnDlHq8ikf6E492q6eKboGOC0T8CDaOvkHCIg8idEI=
|
||||
github.com/go-logr/logr v1.4.3/go.mod h1:9T104GzyrTigFIr8wt5mBrctHMim0Nb2HLGrmQ40KvY=
|
||||
@@ -50,14 +50,16 @@ 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/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/validator/v10 v10.27.0 h1:w8+XrWVMhGkxOaaowyKH35gFydVHOvC0/uWoy2Fzwn4=
|
||||
github.com/go-playground/validator/v10 v10.27.0/go.mod h1:I5QpIEbmr8On7W0TktmJAumgzX4CA1XNl4ZmDuVHKKo=
|
||||
github.com/go-playground/validator/v10 v10.28.0 h1:Q7ibns33JjyW48gHkuFT91qX48KG0ktULL6FgHdG688=
|
||||
github.com/go-playground/validator/v10 v10.28.0/go.mod h1:GoI6I1SjPBh9p7ykNE/yj3fFYbyDOpwMn5KXd+m2hUU=
|
||||
github.com/goccy/go-json v0.10.5 h1:Fq85nIqj+gXn/S5ahsiTlK3TmC85qgirsdTP/+DeaC4=
|
||||
github.com/goccy/go-json v0.10.5/go.mod h1:oq7eo15ShAhp70Anwd5lgX2pLfOS3QCiwU/PULtXL6M=
|
||||
github.com/goccy/go-yaml v1.18.0 h1:8W7wMFS12Pcas7KU+VVkaiCng+kG8QiFeFwzFb+rwuw=
|
||||
github.com/goccy/go-yaml v1.18.0/go.mod h1:XBurs7gK8ATbW4ZPGKgcbrY1Br56PdM69F7LkFRi1kA=
|
||||
github.com/golang-jwt/jwt/v5 v5.2.2 h1:Rl4B7itRWVtYIHFrSNd7vhTiz9UpLdi6gZhZ3wEeDy8=
|
||||
github.com/golang-jwt/jwt/v5 v5.2.2/go.mod h1:pqrtFR0X4osieyHYxtmOUWsAWrfe1Q5UVIyoH402zdk=
|
||||
github.com/google/flatbuffers v25.2.10+incompatible h1:F3vclr7C3HpB1k9mxCGRMXq6FdUalZ6H/pNX4FP1v0Q=
|
||||
github.com/google/flatbuffers v25.2.10+incompatible/go.mod h1:1AeVuKshWv4vARoZatz6mlQ0JxURH0Kv5+zNeJKJCa8=
|
||||
github.com/google/flatbuffers v25.9.23+incompatible h1:rGZKv+wOb6QPzIdkM2KxhBZCDrA0DeN6DNmRDrqIsQU=
|
||||
github.com/google/flatbuffers v25.9.23+incompatible/go.mod h1:1AeVuKshWv4vARoZatz6mlQ0JxURH0Kv5+zNeJKJCa8=
|
||||
github.com/google/go-cmp v0.7.0 h1:wk8382ETsv4JYUZwIsn6YpYiWiBsYLSJiTsyBybVuN8=
|
||||
github.com/google/go-cmp v0.7.0/go.mod h1:pXiqmnSA92OHEEa9HXL2W4E7lf9JzCmGVUdgjX3N/iU=
|
||||
github.com/google/gofuzz v1.0.0/go.mod h1:dBl0BpW6vV/+mYPU4Po3pmUjxk6FQPldtuIdl/M65Eg=
|
||||
@@ -90,6 +92,10 @@ github.com/pkg/browser v0.0.0-20240102092130-5ac0b6a4141c h1:+mdjkGKdHQG3305AYmd
|
||||
github.com/pkg/browser v0.0.0-20240102092130-5ac0b6a4141c/go.mod h1:7rwL4CYBLnjLxUqIJNnCWiEdr3bn6IUYi15bNlnbCCU=
|
||||
github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM=
|
||||
github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4=
|
||||
github.com/quic-go/qpack v0.5.1 h1:giqksBPnT/HDtZ6VhtFKgoLOWmlyo9Ei6u9PqzIMbhI=
|
||||
github.com/quic-go/qpack v0.5.1/go.mod h1:+PC4XFrEskIVkcLzpEkbLqq1uCoxPhQuvK5rH1ZgaEg=
|
||||
github.com/quic-go/quic-go v0.55.0 h1:zccPQIqYCXDt5NmcEabyYvOnomjs8Tlwl7tISjJh9Mk=
|
||||
github.com/quic-go/quic-go v0.55.0/go.mod h1:DR51ilwU1uE164KuWXhinFcKWGlEjzys2l8zUl5Ss1U=
|
||||
github.com/rogpeppe/go-internal v1.14.1 h1:UQB4HGPB6osV0SQTLymcB4TgvyWu6ZyliaW0tI/otEQ=
|
||||
github.com/rogpeppe/go-internal v1.14.1/go.mod h1:MaRKkUm5W0goXpeCfT7UZI6fk/L7L7so1lCWt35ZSgc=
|
||||
github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME=
|
||||
@@ -117,21 +123,29 @@ go.opentelemetry.io/otel/metric v1.38.0 h1:Kl6lzIYGAh5M159u9NgiRkmoMKjvbsKtYRwgf
|
||||
go.opentelemetry.io/otel/metric v1.38.0/go.mod h1:kB5n/QoRM8YwmUahxvI3bO34eVtQf2i4utNVLr9gEmI=
|
||||
go.opentelemetry.io/otel/trace v1.38.0 h1:Fxk5bKrDZJUH+AMyyIXGcFAPah0oRcT+LuNtJrmcNLE=
|
||||
go.opentelemetry.io/otel/trace v1.38.0/go.mod h1:j1P9ivuFsTceSWe1oY+EeW3sc+Pp42sO++GHkg4wwhs=
|
||||
golang.org/x/arch v0.21.0 h1:iTC9o7+wP6cPWpDWkivCvQFGAHDQ59SrSxsLPcnkArw=
|
||||
golang.org/x/arch v0.21.0/go.mod h1:dNHoOeKiyja7GTvF9NJS1l3Z2yntpQNzgrjh1cU103A=
|
||||
golang.org/x/crypto v0.42.0 h1:chiH31gIWm57EkTXpwnqf8qeuMUi0yekh6mT2AvFlqI=
|
||||
golang.org/x/crypto v0.42.0/go.mod h1:4+rDnOTJhQCx2q7/j6rAN5XDw8kPjeaXEUR2eL94ix8=
|
||||
golang.org/x/exp v0.0.0-20250911091902-df9299821621 h1:2id6c1/gto0kaHYyrixvknJ8tUK/Qs5IsmBtrc+FtgU=
|
||||
golang.org/x/exp v0.0.0-20250911091902-df9299821621/go.mod h1:TwQYMMnGpvZyc+JpB/UAuTNIsVJifOlSkrZkhcvpVUk=
|
||||
golang.org/x/net v0.44.0 h1:evd8IRDyfNBMBTTY5XRF1vaZlD+EmWx6x8PkhR04H/I=
|
||||
golang.org/x/net v0.44.0/go.mod h1:ECOoLqd5U3Lhyeyo/QDCEVQ4sNgYsqvCZ722XogGieY=
|
||||
go.uber.org/mock v0.6.0 h1:hyF9dfmbgIX5EfOdasqLsWD6xqpNZlXblLB/Dbnwv3Y=
|
||||
go.uber.org/mock v0.6.0/go.mod h1:KiVJ4BqZJaMj4svdfmHM0AUx4NJYO8ZNpPnZn1Z+BBU=
|
||||
golang.org/x/arch v0.22.0 h1:c/Zle32i5ttqRXjdLyyHZESLD/bB90DCU1g9l/0YBDI=
|
||||
golang.org/x/arch v0.22.0/go.mod h1:dNHoOeKiyja7GTvF9NJS1l3Z2yntpQNzgrjh1cU103A=
|
||||
golang.org/x/crypto v0.43.0 h1:dduJYIi3A3KOfdGOHX8AVZ/jGiyPa3IbBozJ5kNuE04=
|
||||
golang.org/x/crypto v0.43.0/go.mod h1:BFbav4mRNlXJL4wNeejLpWxB7wMbc79PdRGhWKncxR0=
|
||||
golang.org/x/exp v0.0.0-20251002181428-27f1f14c8bb9 h1:TQwNpfvNkxAVlItJf6Cr5JTsVZoC/Sj7K3OZv2Pc14A=
|
||||
golang.org/x/exp v0.0.0-20251002181428-27f1f14c8bb9/go.mod h1:TwQYMMnGpvZyc+JpB/UAuTNIsVJifOlSkrZkhcvpVUk=
|
||||
golang.org/x/mod v0.29.0 h1:HV8lRxZC4l2cr3Zq1LvtOsi/ThTgWnUk/y64QSs8GwA=
|
||||
golang.org/x/mod v0.29.0/go.mod h1:NyhrlYXJ2H4eJiRy/WDBO6HMqZQ6q9nk4JzS3NuCK+w=
|
||||
golang.org/x/net v0.45.0 h1:RLBg5JKixCy82FtLJpeNlVM0nrSqpCRYzVU1n8kj0tM=
|
||||
golang.org/x/net v0.45.0/go.mod h1:ECOoLqd5U3Lhyeyo/QDCEVQ4sNgYsqvCZ722XogGieY=
|
||||
golang.org/x/sync v0.17.0 h1:l60nONMj9l5drqw6jlhIELNv9I0A4OFgRsG9k2oT9Ug=
|
||||
golang.org/x/sync v0.17.0/go.mod h1:9KTHXmSnoGruLpwFjVSX0lNNA75CykiMECbovNTZqGI=
|
||||
golang.org/x/sys v0.6.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
|
||||
golang.org/x/sys v0.36.0 h1:KVRy2GtZBrk1cBYA7MKu5bEZFxQk4NIDV6RLVcC8o0k=
|
||||
golang.org/x/sys v0.36.0/go.mod h1:OgkHotnGiDImocRcuBABYBEXf8A9a87e/uXjp9XT3ks=
|
||||
golang.org/x/text v0.29.0 h1:1neNs90w9YzJ9BocxfsQNHKuAT4pkghyXc4nhZ6sJvk=
|
||||
golang.org/x/text v0.29.0/go.mod h1:7MhJOA9CD2qZyOKYazxdYMF85OwPdEr9jTtBpO7ydH4=
|
||||
google.golang.org/protobuf v1.36.9 h1:w2gp2mA27hUeUzj9Ex9FBjsBm40zfaDtEWow293U7Iw=
|
||||
google.golang.org/protobuf v1.36.9/go.mod h1:fuxRtAxBytpl4zzqUh6/eyUujkJdNiuEkXntxiD/uRU=
|
||||
golang.org/x/sys v0.37.0 h1:fdNQudmxPjkdUTPnLn5mdQv7Zwvbvpaxqs831goi9kQ=
|
||||
golang.org/x/sys v0.37.0/go.mod h1:OgkHotnGiDImocRcuBABYBEXf8A9a87e/uXjp9XT3ks=
|
||||
golang.org/x/text v0.30.0 h1:yznKA/E9zq54KzlzBEAWn1NXSQ8DIp/NYMy88xJjl4k=
|
||||
golang.org/x/text v0.30.0/go.mod h1:yDdHFIX9t+tORqspjENWgzaCVXgk0yYnYuSZ8UzzBVM=
|
||||
golang.org/x/tools v0.37.0 h1:DVSRzp7FwePZW356yEAChSdNcQo6Nsp+fex1SUW09lE=
|
||||
golang.org/x/tools v0.37.0/go.mod h1:MBN5QPQtLMHVdvsbtarmTNukZDdgwdwlO5qGacAzF0w=
|
||||
google.golang.org/protobuf v1.36.10 h1:AYd7cD/uASjIL6Q9LiTjz8JLcrh/88q5UObnmY3aOOE=
|
||||
google.golang.org/protobuf v1.36.10/go.mod h1:HTf+CrKn2C3g5S8VImy6tdcUvCska2kB7j23XfzDpco=
|
||||
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/go.mod h1:JHkPIbrfpd72SG/EVd6muEfDQjcINNoR0C8j2r3qZ4Q=
|
||||
|
||||
@@ -54,7 +54,6 @@ func (r *BadgerDataStore) DeleteCollection(databaseId string, collectionId strin
|
||||
generateKey(resourceid.ResourceTypeTrigger, databaseId, collectionId, "") + "/",
|
||||
generateKey(resourceid.ResourceTypeStoredProcedure, databaseId, collectionId, "") + "/",
|
||||
generateKey(resourceid.ResourceTypeUserDefinedFunction, databaseId, collectionId, "") + "/",
|
||||
collectionKey,
|
||||
}
|
||||
for _, prefix := range prefixes {
|
||||
if err := deleteKeysByPrefix(txn, prefix); err != nil {
|
||||
@@ -62,6 +61,8 @@ func (r *BadgerDataStore) DeleteCollection(databaseId string, collectionId strin
|
||||
}
|
||||
}
|
||||
|
||||
deleteKey(txn, collectionKey)
|
||||
|
||||
err := txn.Commit()
|
||||
if err != nil {
|
||||
logger.ErrorLn("Error while committing transaction:", err)
|
||||
|
||||
@@ -43,7 +43,6 @@ func (r *BadgerDataStore) DeleteDatabase(id string) datastore.DataStoreStatus {
|
||||
generateKey(resourceid.ResourceTypeTrigger, id, "", "") + "/",
|
||||
generateKey(resourceid.ResourceTypeStoredProcedure, id, "", "") + "/",
|
||||
generateKey(resourceid.ResourceTypeUserDefinedFunction, id, "", "") + "/",
|
||||
databaseKey,
|
||||
}
|
||||
for _, prefix := range prefixes {
|
||||
if err := deleteKeysByPrefix(txn, prefix); err != nil {
|
||||
@@ -51,6 +50,8 @@ func (r *BadgerDataStore) DeleteDatabase(id string) datastore.DataStoreStatus {
|
||||
}
|
||||
}
|
||||
|
||||
deleteKey(txn, databaseKey)
|
||||
|
||||
err := txn.Commit()
|
||||
if err != nil {
|
||||
logger.ErrorLn("Error while committing transaction:", err)
|
||||
|
||||
@@ -202,3 +202,22 @@ func deleteKeysByPrefix(txn *badger.Txn, prefix string) error {
|
||||
|
||||
return nil
|
||||
}
|
||||
|
||||
func deleteKey(txn *badger.Txn, key string) error {
|
||||
_, err := txn.Get([]byte(key))
|
||||
if err == badger.ErrKeyNotFound {
|
||||
return nil
|
||||
}
|
||||
if err != nil {
|
||||
logger.ErrorLn("Error while checking if key exists:", err)
|
||||
return err
|
||||
}
|
||||
|
||||
err = txn.Delete([]byte(key))
|
||||
if err != nil {
|
||||
logger.ErrorLn("Error while deleting key:", err)
|
||||
return err
|
||||
}
|
||||
|
||||
return nil
|
||||
}
|
||||
|
||||
@@ -11,12 +11,12 @@ type Database struct {
|
||||
type DataStoreStatus int
|
||||
|
||||
const (
|
||||
StatusOk = 1
|
||||
StatusNotFound = 2
|
||||
Conflict = 3
|
||||
BadRequest = 4
|
||||
IterEOF = 5
|
||||
Unknown = 6
|
||||
StatusOk DataStoreStatus = 1
|
||||
StatusNotFound DataStoreStatus = 2
|
||||
Conflict DataStoreStatus = 3
|
||||
BadRequest DataStoreStatus = 4
|
||||
IterEOF DataStoreStatus = 5
|
||||
Unknown DataStoreStatus = 6
|
||||
)
|
||||
|
||||
type TriggerOperation string
|
||||
|
||||
@@ -112,6 +112,37 @@ func Test_Parse(t *testing.T) {
|
||||
)
|
||||
})
|
||||
|
||||
t.Run("Should parse NOT IN function", func(t *testing.T) {
|
||||
testQueryParse(
|
||||
t,
|
||||
`SELECT c.id FROM c WHERE c.id NOT IN ("123", "456")`,
|
||||
parsers.SelectStmt{
|
||||
SelectItems: []parsers.SelectItem{
|
||||
{
|
||||
Path: []string{"c", "id"},
|
||||
Type: parsers.SelectItemTypeField,
|
||||
},
|
||||
},
|
||||
Table: parsers.Table{SelectItem: testutils.SelectItem_Path("c")},
|
||||
Filters: parsers.SelectItem{
|
||||
Type: parsers.SelectItemTypeFunctionCall,
|
||||
Invert: true,
|
||||
Value: parsers.FunctionCall{
|
||||
Type: parsers.FunctionCallIn,
|
||||
Arguments: []interface{}{
|
||||
parsers.SelectItem{
|
||||
Path: []string{"c", "id"},
|
||||
Type: parsers.SelectItemTypeField,
|
||||
},
|
||||
testutils.SelectItem_Constant_String("123"),
|
||||
testutils.SelectItem_Constant_String("456"),
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
)
|
||||
})
|
||||
|
||||
t.Run("Should parse IN function with function call", func(t *testing.T) {
|
||||
testQueryParse(
|
||||
t,
|
||||
|
||||
@@ -7684,62 +7684,84 @@ var g = &grammar{
|
||||
pos: position{line: 806, col: 34, offset: 30528},
|
||||
name: "ws",
|
||||
},
|
||||
&labeledExpr{
|
||||
pos: position{line: 806, col: 37, offset: 30531},
|
||||
label: "notIn",
|
||||
expr: &zeroOrOneExpr{
|
||||
pos: position{line: 806, col: 43, offset: 30537},
|
||||
expr: &seqExpr{
|
||||
pos: position{line: 806, col: 44, offset: 30538},
|
||||
exprs: []any{
|
||||
&litMatcher{
|
||||
pos: position{line: 806, col: 44, offset: 30538},
|
||||
val: "not",
|
||||
ignoreCase: true,
|
||||
want: "\"NOT\"i",
|
||||
},
|
||||
&ruleRefExpr{
|
||||
pos: position{line: 806, col: 51, offset: 30545},
|
||||
name: "ws",
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
&ruleRefExpr{
|
||||
pos: position{line: 806, col: 37, offset: 30531},
|
||||
pos: position{line: 806, col: 56, offset: 30550},
|
||||
name: "In",
|
||||
},
|
||||
&ruleRefExpr{
|
||||
pos: position{line: 806, col: 40, offset: 30534},
|
||||
pos: position{line: 806, col: 59, offset: 30553},
|
||||
name: "ws",
|
||||
},
|
||||
&litMatcher{
|
||||
pos: position{line: 806, col: 43, offset: 30537},
|
||||
pos: position{line: 806, col: 62, offset: 30556},
|
||||
val: "(",
|
||||
ignoreCase: false,
|
||||
want: "\"(\"",
|
||||
},
|
||||
&ruleRefExpr{
|
||||
pos: position{line: 806, col: 47, offset: 30541},
|
||||
pos: position{line: 806, col: 66, offset: 30560},
|
||||
name: "ws",
|
||||
},
|
||||
&labeledExpr{
|
||||
pos: position{line: 806, col: 50, offset: 30544},
|
||||
pos: position{line: 806, col: 69, offset: 30563},
|
||||
label: "ex2",
|
||||
expr: &ruleRefExpr{
|
||||
pos: position{line: 806, col: 54, offset: 30548},
|
||||
pos: position{line: 806, col: 73, offset: 30567},
|
||||
name: "SelectItem",
|
||||
},
|
||||
},
|
||||
&labeledExpr{
|
||||
pos: position{line: 806, col: 65, offset: 30559},
|
||||
pos: position{line: 806, col: 84, offset: 30578},
|
||||
label: "others",
|
||||
expr: &zeroOrMoreExpr{
|
||||
pos: position{line: 806, col: 72, offset: 30566},
|
||||
pos: position{line: 806, col: 91, offset: 30585},
|
||||
expr: &actionExpr{
|
||||
pos: position{line: 806, col: 73, offset: 30567},
|
||||
run: (*parser).callonInFunction15,
|
||||
pos: position{line: 806, col: 92, offset: 30586},
|
||||
run: (*parser).callonInFunction20,
|
||||
expr: &seqExpr{
|
||||
pos: position{line: 806, col: 73, offset: 30567},
|
||||
pos: position{line: 806, col: 92, offset: 30586},
|
||||
exprs: []any{
|
||||
&ruleRefExpr{
|
||||
pos: position{line: 806, col: 73, offset: 30567},
|
||||
pos: position{line: 806, col: 92, offset: 30586},
|
||||
name: "ws",
|
||||
},
|
||||
&litMatcher{
|
||||
pos: position{line: 806, col: 76, offset: 30570},
|
||||
pos: position{line: 806, col: 95, offset: 30589},
|
||||
val: ",",
|
||||
ignoreCase: false,
|
||||
want: "\",\"",
|
||||
},
|
||||
&ruleRefExpr{
|
||||
pos: position{line: 806, col: 80, offset: 30574},
|
||||
pos: position{line: 806, col: 99, offset: 30593},
|
||||
name: "ws",
|
||||
},
|
||||
&labeledExpr{
|
||||
pos: position{line: 806, col: 83, offset: 30577},
|
||||
pos: position{line: 806, col: 102, offset: 30596},
|
||||
label: "ex",
|
||||
expr: &ruleRefExpr{
|
||||
pos: position{line: 806, col: 86, offset: 30580},
|
||||
pos: position{line: 806, col: 105, offset: 30599},
|
||||
name: "SelectItem",
|
||||
},
|
||||
},
|
||||
@@ -7749,11 +7771,11 @@ var g = &grammar{
|
||||
},
|
||||
},
|
||||
&ruleRefExpr{
|
||||
pos: position{line: 806, col: 118, offset: 30612},
|
||||
pos: position{line: 806, col: 137, offset: 30631},
|
||||
name: "ws",
|
||||
},
|
||||
&litMatcher{
|
||||
pos: position{line: 806, col: 121, offset: 30615},
|
||||
pos: position{line: 806, col: 140, offset: 30634},
|
||||
val: ")",
|
||||
ignoreCase: false,
|
||||
want: "\")\"",
|
||||
@@ -7762,89 +7784,111 @@ var g = &grammar{
|
||||
},
|
||||
},
|
||||
&actionExpr{
|
||||
pos: position{line: 808, col: 5, offset: 30739},
|
||||
run: (*parser).callonInFunction24,
|
||||
pos: position{line: 820, col: 3, offset: 31027},
|
||||
run: (*parser).callonInFunction29,
|
||||
expr: &seqExpr{
|
||||
pos: position{line: 808, col: 5, offset: 30739},
|
||||
pos: position{line: 820, col: 3, offset: 31027},
|
||||
exprs: []any{
|
||||
&litMatcher{
|
||||
pos: position{line: 808, col: 5, offset: 30739},
|
||||
pos: position{line: 820, col: 3, offset: 31027},
|
||||
val: "(",
|
||||
ignoreCase: false,
|
||||
want: "\"(\"",
|
||||
},
|
||||
&ruleRefExpr{
|
||||
pos: position{line: 808, col: 9, offset: 30743},
|
||||
pos: position{line: 820, col: 7, offset: 31031},
|
||||
name: "ws",
|
||||
},
|
||||
&labeledExpr{
|
||||
pos: position{line: 808, col: 12, offset: 30746},
|
||||
pos: position{line: 820, col: 10, offset: 31034},
|
||||
label: "ex1",
|
||||
expr: &ruleRefExpr{
|
||||
pos: position{line: 808, col: 16, offset: 30750},
|
||||
pos: position{line: 820, col: 14, offset: 31038},
|
||||
name: "SelectItem",
|
||||
},
|
||||
},
|
||||
&ruleRefExpr{
|
||||
pos: position{line: 808, col: 27, offset: 30761},
|
||||
pos: position{line: 820, col: 25, offset: 31049},
|
||||
name: "ws",
|
||||
},
|
||||
&labeledExpr{
|
||||
pos: position{line: 820, col: 28, offset: 31052},
|
||||
label: "notIn",
|
||||
expr: &zeroOrOneExpr{
|
||||
pos: position{line: 820, col: 34, offset: 31058},
|
||||
expr: &seqExpr{
|
||||
pos: position{line: 820, col: 35, offset: 31059},
|
||||
exprs: []any{
|
||||
&litMatcher{
|
||||
pos: position{line: 820, col: 35, offset: 31059},
|
||||
val: "not",
|
||||
ignoreCase: true,
|
||||
want: "\"NOT\"i",
|
||||
},
|
||||
&ruleRefExpr{
|
||||
pos: position{line: 820, col: 42, offset: 31066},
|
||||
name: "ws",
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
&ruleRefExpr{
|
||||
pos: position{line: 808, col: 30, offset: 30764},
|
||||
pos: position{line: 820, col: 47, offset: 31071},
|
||||
name: "In",
|
||||
},
|
||||
&ruleRefExpr{
|
||||
pos: position{line: 808, col: 33, offset: 30767},
|
||||
pos: position{line: 820, col: 50, offset: 31074},
|
||||
name: "ws",
|
||||
},
|
||||
&litMatcher{
|
||||
pos: position{line: 808, col: 36, offset: 30770},
|
||||
pos: position{line: 820, col: 53, offset: 31077},
|
||||
val: "(",
|
||||
ignoreCase: false,
|
||||
want: "\"(\"",
|
||||
},
|
||||
&ruleRefExpr{
|
||||
pos: position{line: 808, col: 40, offset: 30774},
|
||||
pos: position{line: 820, col: 57, offset: 31081},
|
||||
name: "ws",
|
||||
},
|
||||
&labeledExpr{
|
||||
pos: position{line: 808, col: 43, offset: 30777},
|
||||
pos: position{line: 820, col: 60, offset: 31084},
|
||||
label: "ex2",
|
||||
expr: &ruleRefExpr{
|
||||
pos: position{line: 808, col: 47, offset: 30781},
|
||||
pos: position{line: 820, col: 64, offset: 31088},
|
||||
name: "SelectItem",
|
||||
},
|
||||
},
|
||||
&labeledExpr{
|
||||
pos: position{line: 808, col: 58, offset: 30792},
|
||||
pos: position{line: 820, col: 75, offset: 31099},
|
||||
label: "others",
|
||||
expr: &zeroOrMoreExpr{
|
||||
pos: position{line: 808, col: 65, offset: 30799},
|
||||
pos: position{line: 820, col: 82, offset: 31106},
|
||||
expr: &actionExpr{
|
||||
pos: position{line: 808, col: 66, offset: 30800},
|
||||
run: (*parser).callonInFunction39,
|
||||
pos: position{line: 820, col: 83, offset: 31107},
|
||||
run: (*parser).callonInFunction49,
|
||||
expr: &seqExpr{
|
||||
pos: position{line: 808, col: 66, offset: 30800},
|
||||
pos: position{line: 820, col: 83, offset: 31107},
|
||||
exprs: []any{
|
||||
&ruleRefExpr{
|
||||
pos: position{line: 808, col: 66, offset: 30800},
|
||||
pos: position{line: 820, col: 83, offset: 31107},
|
||||
name: "ws",
|
||||
},
|
||||
&litMatcher{
|
||||
pos: position{line: 808, col: 69, offset: 30803},
|
||||
pos: position{line: 820, col: 86, offset: 31110},
|
||||
val: ",",
|
||||
ignoreCase: false,
|
||||
want: "\",\"",
|
||||
},
|
||||
&ruleRefExpr{
|
||||
pos: position{line: 808, col: 73, offset: 30807},
|
||||
pos: position{line: 820, col: 90, offset: 31114},
|
||||
name: "ws",
|
||||
},
|
||||
&labeledExpr{
|
||||
pos: position{line: 808, col: 76, offset: 30810},
|
||||
pos: position{line: 820, col: 93, offset: 31117},
|
||||
label: "ex",
|
||||
expr: &ruleRefExpr{
|
||||
pos: position{line: 808, col: 79, offset: 30813},
|
||||
pos: position{line: 820, col: 96, offset: 31120},
|
||||
name: "SelectItem",
|
||||
},
|
||||
},
|
||||
@@ -7854,21 +7898,21 @@ var g = &grammar{
|
||||
},
|
||||
},
|
||||
&ruleRefExpr{
|
||||
pos: position{line: 808, col: 111, offset: 30845},
|
||||
pos: position{line: 820, col: 128, offset: 31152},
|
||||
name: "ws",
|
||||
},
|
||||
&litMatcher{
|
||||
pos: position{line: 808, col: 114, offset: 30848},
|
||||
pos: position{line: 820, col: 131, offset: 31155},
|
||||
val: ")",
|
||||
ignoreCase: false,
|
||||
want: "\")\"",
|
||||
},
|
||||
&ruleRefExpr{
|
||||
pos: position{line: 808, col: 118, offset: 30852},
|
||||
pos: position{line: 820, col: 135, offset: 31159},
|
||||
name: "ws",
|
||||
},
|
||||
&litMatcher{
|
||||
pos: position{line: 808, col: 121, offset: 30855},
|
||||
pos: position{line: 820, col: 138, offset: 31162},
|
||||
val: ")",
|
||||
ignoreCase: false,
|
||||
want: "\")\"",
|
||||
@@ -7881,43 +7925,43 @@ var g = &grammar{
|
||||
},
|
||||
{
|
||||
name: "AvgAggregateExpression",
|
||||
pos: position{line: 812, col: 1, offset: 30978},
|
||||
pos: position{line: 835, col: 1, offset: 31550},
|
||||
expr: &actionExpr{
|
||||
pos: position{line: 812, col: 29, offset: 31006},
|
||||
pos: position{line: 835, col: 29, offset: 31578},
|
||||
run: (*parser).callonAvgAggregateExpression1,
|
||||
expr: &seqExpr{
|
||||
pos: position{line: 812, col: 29, offset: 31006},
|
||||
pos: position{line: 835, col: 29, offset: 31578},
|
||||
exprs: []any{
|
||||
&litMatcher{
|
||||
pos: position{line: 812, col: 29, offset: 31006},
|
||||
pos: position{line: 835, col: 29, offset: 31578},
|
||||
val: "avg",
|
||||
ignoreCase: true,
|
||||
want: "\"AVG\"i",
|
||||
},
|
||||
&litMatcher{
|
||||
pos: position{line: 812, col: 36, offset: 31013},
|
||||
pos: position{line: 835, col: 36, offset: 31585},
|
||||
val: "(",
|
||||
ignoreCase: false,
|
||||
want: "\"(\"",
|
||||
},
|
||||
&ruleRefExpr{
|
||||
pos: position{line: 812, col: 40, offset: 31017},
|
||||
pos: position{line: 835, col: 40, offset: 31589},
|
||||
name: "ws",
|
||||
},
|
||||
&labeledExpr{
|
||||
pos: position{line: 812, col: 43, offset: 31020},
|
||||
pos: position{line: 835, col: 43, offset: 31592},
|
||||
label: "ex",
|
||||
expr: &ruleRefExpr{
|
||||
pos: position{line: 812, col: 46, offset: 31023},
|
||||
pos: position{line: 835, col: 46, offset: 31595},
|
||||
name: "SelectItem",
|
||||
},
|
||||
},
|
||||
&ruleRefExpr{
|
||||
pos: position{line: 812, col: 58, offset: 31035},
|
||||
pos: position{line: 835, col: 58, offset: 31607},
|
||||
name: "ws",
|
||||
},
|
||||
&litMatcher{
|
||||
pos: position{line: 812, col: 61, offset: 31038},
|
||||
pos: position{line: 835, col: 61, offset: 31610},
|
||||
val: ")",
|
||||
ignoreCase: false,
|
||||
want: "\")\"",
|
||||
@@ -7928,43 +7972,43 @@ var g = &grammar{
|
||||
},
|
||||
{
|
||||
name: "CountAggregateExpression",
|
||||
pos: position{line: 816, col: 1, offset: 31130},
|
||||
pos: position{line: 839, col: 1, offset: 31702},
|
||||
expr: &actionExpr{
|
||||
pos: position{line: 816, col: 29, offset: 31158},
|
||||
pos: position{line: 839, col: 29, offset: 31730},
|
||||
run: (*parser).callonCountAggregateExpression1,
|
||||
expr: &seqExpr{
|
||||
pos: position{line: 816, col: 29, offset: 31158},
|
||||
pos: position{line: 839, col: 29, offset: 31730},
|
||||
exprs: []any{
|
||||
&litMatcher{
|
||||
pos: position{line: 816, col: 29, offset: 31158},
|
||||
pos: position{line: 839, col: 29, offset: 31730},
|
||||
val: "count",
|
||||
ignoreCase: true,
|
||||
want: "\"COUNT\"i",
|
||||
},
|
||||
&litMatcher{
|
||||
pos: position{line: 816, col: 38, offset: 31167},
|
||||
pos: position{line: 839, col: 38, offset: 31739},
|
||||
val: "(",
|
||||
ignoreCase: false,
|
||||
want: "\"(\"",
|
||||
},
|
||||
&ruleRefExpr{
|
||||
pos: position{line: 816, col: 42, offset: 31171},
|
||||
pos: position{line: 839, col: 42, offset: 31743},
|
||||
name: "ws",
|
||||
},
|
||||
&labeledExpr{
|
||||
pos: position{line: 816, col: 45, offset: 31174},
|
||||
pos: position{line: 839, col: 45, offset: 31746},
|
||||
label: "ex",
|
||||
expr: &ruleRefExpr{
|
||||
pos: position{line: 816, col: 48, offset: 31177},
|
||||
pos: position{line: 839, col: 48, offset: 31749},
|
||||
name: "SelectItem",
|
||||
},
|
||||
},
|
||||
&ruleRefExpr{
|
||||
pos: position{line: 816, col: 59, offset: 31188},
|
||||
pos: position{line: 839, col: 59, offset: 31760},
|
||||
name: "ws",
|
||||
},
|
||||
&litMatcher{
|
||||
pos: position{line: 816, col: 62, offset: 31191},
|
||||
pos: position{line: 839, col: 62, offset: 31763},
|
||||
val: ")",
|
||||
ignoreCase: false,
|
||||
want: "\")\"",
|
||||
@@ -7975,43 +8019,43 @@ var g = &grammar{
|
||||
},
|
||||
{
|
||||
name: "MaxAggregateExpression",
|
||||
pos: position{line: 820, col: 1, offset: 31285},
|
||||
pos: position{line: 843, col: 1, offset: 31857},
|
||||
expr: &actionExpr{
|
||||
pos: position{line: 820, col: 29, offset: 31313},
|
||||
pos: position{line: 843, col: 29, offset: 31885},
|
||||
run: (*parser).callonMaxAggregateExpression1,
|
||||
expr: &seqExpr{
|
||||
pos: position{line: 820, col: 29, offset: 31313},
|
||||
pos: position{line: 843, col: 29, offset: 31885},
|
||||
exprs: []any{
|
||||
&litMatcher{
|
||||
pos: position{line: 820, col: 29, offset: 31313},
|
||||
pos: position{line: 843, col: 29, offset: 31885},
|
||||
val: "max",
|
||||
ignoreCase: true,
|
||||
want: "\"MAX\"i",
|
||||
},
|
||||
&litMatcher{
|
||||
pos: position{line: 820, col: 36, offset: 31320},
|
||||
pos: position{line: 843, col: 36, offset: 31892},
|
||||
val: "(",
|
||||
ignoreCase: false,
|
||||
want: "\"(\"",
|
||||
},
|
||||
&ruleRefExpr{
|
||||
pos: position{line: 820, col: 40, offset: 31324},
|
||||
pos: position{line: 843, col: 40, offset: 31896},
|
||||
name: "ws",
|
||||
},
|
||||
&labeledExpr{
|
||||
pos: position{line: 820, col: 43, offset: 31327},
|
||||
pos: position{line: 843, col: 43, offset: 31899},
|
||||
label: "ex",
|
||||
expr: &ruleRefExpr{
|
||||
pos: position{line: 820, col: 46, offset: 31330},
|
||||
pos: position{line: 843, col: 46, offset: 31902},
|
||||
name: "SelectItem",
|
||||
},
|
||||
},
|
||||
&ruleRefExpr{
|
||||
pos: position{line: 820, col: 57, offset: 31341},
|
||||
pos: position{line: 843, col: 57, offset: 31913},
|
||||
name: "ws",
|
||||
},
|
||||
&litMatcher{
|
||||
pos: position{line: 820, col: 60, offset: 31344},
|
||||
pos: position{line: 843, col: 60, offset: 31916},
|
||||
val: ")",
|
||||
ignoreCase: false,
|
||||
want: "\")\"",
|
||||
@@ -8022,43 +8066,43 @@ var g = &grammar{
|
||||
},
|
||||
{
|
||||
name: "MinAggregateExpression",
|
||||
pos: position{line: 824, col: 1, offset: 31436},
|
||||
pos: position{line: 847, col: 1, offset: 32008},
|
||||
expr: &actionExpr{
|
||||
pos: position{line: 824, col: 29, offset: 31464},
|
||||
pos: position{line: 847, col: 29, offset: 32036},
|
||||
run: (*parser).callonMinAggregateExpression1,
|
||||
expr: &seqExpr{
|
||||
pos: position{line: 824, col: 29, offset: 31464},
|
||||
pos: position{line: 847, col: 29, offset: 32036},
|
||||
exprs: []any{
|
||||
&litMatcher{
|
||||
pos: position{line: 824, col: 29, offset: 31464},
|
||||
pos: position{line: 847, col: 29, offset: 32036},
|
||||
val: "min",
|
||||
ignoreCase: true,
|
||||
want: "\"MIN\"i",
|
||||
},
|
||||
&litMatcher{
|
||||
pos: position{line: 824, col: 36, offset: 31471},
|
||||
pos: position{line: 847, col: 36, offset: 32043},
|
||||
val: "(",
|
||||
ignoreCase: false,
|
||||
want: "\"(\"",
|
||||
},
|
||||
&ruleRefExpr{
|
||||
pos: position{line: 824, col: 40, offset: 31475},
|
||||
pos: position{line: 847, col: 40, offset: 32047},
|
||||
name: "ws",
|
||||
},
|
||||
&labeledExpr{
|
||||
pos: position{line: 824, col: 43, offset: 31478},
|
||||
pos: position{line: 847, col: 43, offset: 32050},
|
||||
label: "ex",
|
||||
expr: &ruleRefExpr{
|
||||
pos: position{line: 824, col: 46, offset: 31481},
|
||||
pos: position{line: 847, col: 46, offset: 32053},
|
||||
name: "SelectItem",
|
||||
},
|
||||
},
|
||||
&ruleRefExpr{
|
||||
pos: position{line: 824, col: 57, offset: 31492},
|
||||
pos: position{line: 847, col: 57, offset: 32064},
|
||||
name: "ws",
|
||||
},
|
||||
&litMatcher{
|
||||
pos: position{line: 824, col: 60, offset: 31495},
|
||||
pos: position{line: 847, col: 60, offset: 32067},
|
||||
val: ")",
|
||||
ignoreCase: false,
|
||||
want: "\")\"",
|
||||
@@ -8069,43 +8113,43 @@ var g = &grammar{
|
||||
},
|
||||
{
|
||||
name: "SumAggregateExpression",
|
||||
pos: position{line: 828, col: 1, offset: 31587},
|
||||
pos: position{line: 851, col: 1, offset: 32159},
|
||||
expr: &actionExpr{
|
||||
pos: position{line: 828, col: 29, offset: 31615},
|
||||
pos: position{line: 851, col: 29, offset: 32187},
|
||||
run: (*parser).callonSumAggregateExpression1,
|
||||
expr: &seqExpr{
|
||||
pos: position{line: 828, col: 29, offset: 31615},
|
||||
pos: position{line: 851, col: 29, offset: 32187},
|
||||
exprs: []any{
|
||||
&litMatcher{
|
||||
pos: position{line: 828, col: 29, offset: 31615},
|
||||
pos: position{line: 851, col: 29, offset: 32187},
|
||||
val: "sum",
|
||||
ignoreCase: true,
|
||||
want: "\"SUM\"i",
|
||||
},
|
||||
&litMatcher{
|
||||
pos: position{line: 828, col: 36, offset: 31622},
|
||||
pos: position{line: 851, col: 36, offset: 32194},
|
||||
val: "(",
|
||||
ignoreCase: false,
|
||||
want: "\"(\"",
|
||||
},
|
||||
&ruleRefExpr{
|
||||
pos: position{line: 828, col: 40, offset: 31626},
|
||||
pos: position{line: 851, col: 40, offset: 32198},
|
||||
name: "ws",
|
||||
},
|
||||
&labeledExpr{
|
||||
pos: position{line: 828, col: 43, offset: 31629},
|
||||
pos: position{line: 851, col: 43, offset: 32201},
|
||||
label: "ex",
|
||||
expr: &ruleRefExpr{
|
||||
pos: position{line: 828, col: 46, offset: 31632},
|
||||
pos: position{line: 851, col: 46, offset: 32204},
|
||||
name: "SelectItem",
|
||||
},
|
||||
},
|
||||
&ruleRefExpr{
|
||||
pos: position{line: 828, col: 57, offset: 31643},
|
||||
pos: position{line: 851, col: 57, offset: 32215},
|
||||
name: "ws",
|
||||
},
|
||||
&litMatcher{
|
||||
pos: position{line: 828, col: 60, offset: 31646},
|
||||
pos: position{line: 851, col: 60, offset: 32218},
|
||||
val: ")",
|
||||
ignoreCase: false,
|
||||
want: "\")\"",
|
||||
@@ -8116,14 +8160,14 @@ var g = &grammar{
|
||||
},
|
||||
{
|
||||
name: "Integer",
|
||||
pos: position{line: 832, col: 1, offset: 31738},
|
||||
pos: position{line: 855, col: 1, offset: 32310},
|
||||
expr: &actionExpr{
|
||||
pos: position{line: 832, col: 12, offset: 31749},
|
||||
pos: position{line: 855, col: 12, offset: 32321},
|
||||
run: (*parser).callonInteger1,
|
||||
expr: &oneOrMoreExpr{
|
||||
pos: position{line: 832, col: 12, offset: 31749},
|
||||
pos: position{line: 855, col: 12, offset: 32321},
|
||||
expr: &charClassMatcher{
|
||||
pos: position{line: 832, col: 12, offset: 31749},
|
||||
pos: position{line: 855, col: 12, offset: 32321},
|
||||
val: "[0-9]",
|
||||
ranges: []rune{'0', '9'},
|
||||
ignoreCase: false,
|
||||
@@ -8134,29 +8178,29 @@ var g = &grammar{
|
||||
},
|
||||
{
|
||||
name: "StringCharacter",
|
||||
pos: position{line: 836, col: 1, offset: 31801},
|
||||
pos: position{line: 859, col: 1, offset: 32373},
|
||||
expr: &choiceExpr{
|
||||
pos: position{line: 836, col: 20, offset: 31820},
|
||||
pos: position{line: 859, col: 20, offset: 32392},
|
||||
alternatives: []any{
|
||||
&actionExpr{
|
||||
pos: position{line: 836, col: 20, offset: 31820},
|
||||
pos: position{line: 859, col: 20, offset: 32392},
|
||||
run: (*parser).callonStringCharacter2,
|
||||
expr: &seqExpr{
|
||||
pos: position{line: 836, col: 20, offset: 31820},
|
||||
pos: position{line: 859, col: 20, offset: 32392},
|
||||
exprs: []any{
|
||||
¬Expr{
|
||||
pos: position{line: 836, col: 20, offset: 31820},
|
||||
pos: position{line: 859, col: 20, offset: 32392},
|
||||
expr: &choiceExpr{
|
||||
pos: position{line: 836, col: 22, offset: 31822},
|
||||
pos: position{line: 859, col: 22, offset: 32394},
|
||||
alternatives: []any{
|
||||
&litMatcher{
|
||||
pos: position{line: 836, col: 22, offset: 31822},
|
||||
pos: position{line: 859, col: 22, offset: 32394},
|
||||
val: "\"",
|
||||
ignoreCase: false,
|
||||
want: "\"\\\"\"",
|
||||
},
|
||||
&litMatcher{
|
||||
pos: position{line: 836, col: 28, offset: 31828},
|
||||
pos: position{line: 859, col: 28, offset: 32400},
|
||||
val: "\\",
|
||||
ignoreCase: false,
|
||||
want: "\"\\\\\"",
|
||||
@@ -8165,28 +8209,28 @@ var g = &grammar{
|
||||
},
|
||||
},
|
||||
&anyMatcher{
|
||||
line: 836, col: 34, offset: 31834,
|
||||
line: 859, col: 34, offset: 32406,
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
&actionExpr{
|
||||
pos: position{line: 837, col: 5, offset: 31871},
|
||||
pos: position{line: 860, col: 5, offset: 32443},
|
||||
run: (*parser).callonStringCharacter9,
|
||||
expr: &seqExpr{
|
||||
pos: position{line: 837, col: 5, offset: 31871},
|
||||
pos: position{line: 860, col: 5, offset: 32443},
|
||||
exprs: []any{
|
||||
&litMatcher{
|
||||
pos: position{line: 837, col: 5, offset: 31871},
|
||||
pos: position{line: 860, col: 5, offset: 32443},
|
||||
val: "\\",
|
||||
ignoreCase: false,
|
||||
want: "\"\\\\\"",
|
||||
},
|
||||
&labeledExpr{
|
||||
pos: position{line: 837, col: 10, offset: 31876},
|
||||
pos: position{line: 860, col: 10, offset: 32448},
|
||||
label: "seq",
|
||||
expr: &ruleRefExpr{
|
||||
pos: position{line: 837, col: 14, offset: 31880},
|
||||
pos: position{line: 860, col: 14, offset: 32452},
|
||||
name: "EscapeSequenceCharacter",
|
||||
},
|
||||
},
|
||||
@@ -8198,85 +8242,85 @@ var g = &grammar{
|
||||
},
|
||||
{
|
||||
name: "EscapeSequenceCharacter",
|
||||
pos: position{line: 839, col: 1, offset: 31925},
|
||||
pos: position{line: 862, col: 1, offset: 32497},
|
||||
expr: &labeledExpr{
|
||||
pos: position{line: 839, col: 28, offset: 31952},
|
||||
pos: position{line: 862, col: 28, offset: 32524},
|
||||
label: "char",
|
||||
expr: &ruleRefExpr{
|
||||
pos: position{line: 839, col: 33, offset: 31957},
|
||||
pos: position{line: 862, col: 33, offset: 32529},
|
||||
name: "EscapeCharacter",
|
||||
},
|
||||
},
|
||||
},
|
||||
{
|
||||
name: "EscapeCharacter",
|
||||
pos: position{line: 841, col: 1, offset: 31974},
|
||||
pos: position{line: 864, col: 1, offset: 32546},
|
||||
expr: &choiceExpr{
|
||||
pos: position{line: 841, col: 20, offset: 31993},
|
||||
pos: position{line: 864, col: 20, offset: 32565},
|
||||
alternatives: []any{
|
||||
&litMatcher{
|
||||
pos: position{line: 841, col: 20, offset: 31993},
|
||||
pos: position{line: 864, col: 20, offset: 32565},
|
||||
val: "'",
|
||||
ignoreCase: false,
|
||||
want: "\"'\"",
|
||||
},
|
||||
&litMatcher{
|
||||
pos: position{line: 842, col: 5, offset: 32001},
|
||||
pos: position{line: 865, col: 5, offset: 32573},
|
||||
val: "\"",
|
||||
ignoreCase: false,
|
||||
want: "\"\\\"\"",
|
||||
},
|
||||
&litMatcher{
|
||||
pos: position{line: 843, col: 5, offset: 32009},
|
||||
pos: position{line: 866, col: 5, offset: 32581},
|
||||
val: "\\",
|
||||
ignoreCase: false,
|
||||
want: "\"\\\\\"",
|
||||
},
|
||||
&actionExpr{
|
||||
pos: position{line: 844, col: 5, offset: 32018},
|
||||
pos: position{line: 867, col: 5, offset: 32590},
|
||||
run: (*parser).callonEscapeCharacter5,
|
||||
expr: &litMatcher{
|
||||
pos: position{line: 844, col: 5, offset: 32018},
|
||||
pos: position{line: 867, col: 5, offset: 32590},
|
||||
val: "b",
|
||||
ignoreCase: false,
|
||||
want: "\"b\"",
|
||||
},
|
||||
},
|
||||
&actionExpr{
|
||||
pos: position{line: 845, col: 5, offset: 32047},
|
||||
pos: position{line: 868, col: 5, offset: 32619},
|
||||
run: (*parser).callonEscapeCharacter7,
|
||||
expr: &litMatcher{
|
||||
pos: position{line: 845, col: 5, offset: 32047},
|
||||
pos: position{line: 868, col: 5, offset: 32619},
|
||||
val: "f",
|
||||
ignoreCase: false,
|
||||
want: "\"f\"",
|
||||
},
|
||||
},
|
||||
&actionExpr{
|
||||
pos: position{line: 846, col: 5, offset: 32076},
|
||||
pos: position{line: 869, col: 5, offset: 32648},
|
||||
run: (*parser).callonEscapeCharacter9,
|
||||
expr: &litMatcher{
|
||||
pos: position{line: 846, col: 5, offset: 32076},
|
||||
pos: position{line: 869, col: 5, offset: 32648},
|
||||
val: "n",
|
||||
ignoreCase: false,
|
||||
want: "\"n\"",
|
||||
},
|
||||
},
|
||||
&actionExpr{
|
||||
pos: position{line: 847, col: 5, offset: 32105},
|
||||
pos: position{line: 870, col: 5, offset: 32677},
|
||||
run: (*parser).callonEscapeCharacter11,
|
||||
expr: &litMatcher{
|
||||
pos: position{line: 847, col: 5, offset: 32105},
|
||||
pos: position{line: 870, col: 5, offset: 32677},
|
||||
val: "r",
|
||||
ignoreCase: false,
|
||||
want: "\"r\"",
|
||||
},
|
||||
},
|
||||
&actionExpr{
|
||||
pos: position{line: 848, col: 5, offset: 32134},
|
||||
pos: position{line: 871, col: 5, offset: 32706},
|
||||
run: (*parser).callonEscapeCharacter13,
|
||||
expr: &litMatcher{
|
||||
pos: position{line: 848, col: 5, offset: 32134},
|
||||
pos: position{line: 871, col: 5, offset: 32706},
|
||||
val: "t",
|
||||
ignoreCase: false,
|
||||
want: "\"t\"",
|
||||
@@ -8287,25 +8331,25 @@ var g = &grammar{
|
||||
},
|
||||
{
|
||||
name: "non_escape_character",
|
||||
pos: position{line: 850, col: 1, offset: 32160},
|
||||
pos: position{line: 873, col: 1, offset: 32732},
|
||||
expr: &actionExpr{
|
||||
pos: position{line: 850, col: 25, offset: 32184},
|
||||
pos: position{line: 873, col: 25, offset: 32756},
|
||||
run: (*parser).callonnon_escape_character1,
|
||||
expr: &seqExpr{
|
||||
pos: position{line: 850, col: 25, offset: 32184},
|
||||
pos: position{line: 873, col: 25, offset: 32756},
|
||||
exprs: []any{
|
||||
¬Expr{
|
||||
pos: position{line: 850, col: 25, offset: 32184},
|
||||
pos: position{line: 873, col: 25, offset: 32756},
|
||||
expr: &ruleRefExpr{
|
||||
pos: position{line: 850, col: 27, offset: 32186},
|
||||
pos: position{line: 873, col: 27, offset: 32758},
|
||||
name: "escape_character",
|
||||
},
|
||||
},
|
||||
&labeledExpr{
|
||||
pos: position{line: 850, col: 45, offset: 32204},
|
||||
pos: position{line: 873, col: 45, offset: 32776},
|
||||
label: "char",
|
||||
expr: &anyMatcher{
|
||||
line: 850, col: 50, offset: 32209,
|
||||
line: 873, col: 50, offset: 32781,
|
||||
},
|
||||
},
|
||||
},
|
||||
@@ -8314,11 +8358,11 @@ var g = &grammar{
|
||||
},
|
||||
{
|
||||
name: "ws",
|
||||
pos: position{line: 853, col: 1, offset: 32248},
|
||||
pos: position{line: 876, col: 1, offset: 32820},
|
||||
expr: &zeroOrMoreExpr{
|
||||
pos: position{line: 853, col: 7, offset: 32254},
|
||||
pos: position{line: 876, col: 7, offset: 32826},
|
||||
expr: &charClassMatcher{
|
||||
pos: position{line: 853, col: 7, offset: 32254},
|
||||
pos: position{line: 876, col: 7, offset: 32826},
|
||||
val: "[ \\t\\n\\r]",
|
||||
chars: []rune{' ', '\t', '\n', '\r'},
|
||||
ignoreCase: false,
|
||||
@@ -8328,11 +8372,11 @@ var g = &grammar{
|
||||
},
|
||||
{
|
||||
name: "wss",
|
||||
pos: position{line: 855, col: 1, offset: 32266},
|
||||
pos: position{line: 878, col: 1, offset: 32838},
|
||||
expr: &oneOrMoreExpr{
|
||||
pos: position{line: 855, col: 8, offset: 32273},
|
||||
pos: position{line: 878, col: 8, offset: 32845},
|
||||
expr: &charClassMatcher{
|
||||
pos: position{line: 855, col: 8, offset: 32273},
|
||||
pos: position{line: 878, col: 8, offset: 32845},
|
||||
val: "[ \\t\\n\\r]",
|
||||
chars: []rune{' ', '\t', '\n', '\r'},
|
||||
ignoreCase: false,
|
||||
@@ -8342,11 +8386,11 @@ var g = &grammar{
|
||||
},
|
||||
{
|
||||
name: "EOF",
|
||||
pos: position{line: 857, col: 1, offset: 32285},
|
||||
pos: position{line: 880, col: 1, offset: 32857},
|
||||
expr: ¬Expr{
|
||||
pos: position{line: 857, col: 8, offset: 32292},
|
||||
pos: position{line: 880, col: 8, offset: 32864},
|
||||
expr: &anyMatcher{
|
||||
line: 857, col: 9, offset: 32293,
|
||||
line: 880, col: 9, offset: 32865,
|
||||
},
|
||||
},
|
||||
},
|
||||
@@ -9959,44 +10003,66 @@ func (p *parser) callonMathRandExpression1() (any, error) {
|
||||
return p.cur.onMathRandExpression1()
|
||||
}
|
||||
|
||||
func (c *current) onInFunction15(ex any) (any, error) {
|
||||
func (c *current) onInFunction20(ex any) (any, error) {
|
||||
return ex, nil
|
||||
}
|
||||
|
||||
func (p *parser) callonInFunction15() (any, error) {
|
||||
func (p *parser) callonInFunction20() (any, error) {
|
||||
stack := p.vstack[len(p.vstack)-1]
|
||||
_ = stack
|
||||
return p.cur.onInFunction15(stack["ex"])
|
||||
return p.cur.onInFunction20(stack["ex"])
|
||||
}
|
||||
|
||||
func (c *current) onInFunction2(ex1, ex2, others any) (any, error) {
|
||||
return createFunctionCall(parsers.FunctionCallIn, append([]interface{}{ex1, ex2}, others.([]interface{})...))
|
||||
func (c *current) onInFunction2(ex1, notIn, ex2, others any) (any, error) {
|
||||
arguments := append([]interface{}{ex1, ex2}, others.([]interface{})...)
|
||||
functionCall, _ := createFunctionCall(parsers.FunctionCallIn, arguments)
|
||||
|
||||
if notIn != nil {
|
||||
return parsers.SelectItem{
|
||||
Type: parsers.SelectItemTypeFunctionCall,
|
||||
Value: functionCall,
|
||||
Invert: true,
|
||||
}, nil
|
||||
}
|
||||
|
||||
return functionCall, nil
|
||||
}
|
||||
|
||||
func (p *parser) callonInFunction2() (any, error) {
|
||||
stack := p.vstack[len(p.vstack)-1]
|
||||
_ = stack
|
||||
return p.cur.onInFunction2(stack["ex1"], stack["ex2"], stack["others"])
|
||||
return p.cur.onInFunction2(stack["ex1"], stack["notIn"], stack["ex2"], stack["others"])
|
||||
}
|
||||
|
||||
func (c *current) onInFunction39(ex any) (any, error) {
|
||||
func (c *current) onInFunction49(ex any) (any, error) {
|
||||
return ex, nil
|
||||
}
|
||||
|
||||
func (p *parser) callonInFunction39() (any, error) {
|
||||
func (p *parser) callonInFunction49() (any, error) {
|
||||
stack := p.vstack[len(p.vstack)-1]
|
||||
_ = stack
|
||||
return p.cur.onInFunction39(stack["ex"])
|
||||
return p.cur.onInFunction49(stack["ex"])
|
||||
}
|
||||
|
||||
func (c *current) onInFunction24(ex1, ex2, others any) (any, error) {
|
||||
return createFunctionCall(parsers.FunctionCallIn, append([]interface{}{ex1, ex2}, others.([]interface{})...))
|
||||
func (c *current) onInFunction29(ex1, notIn, ex2, others any) (any, error) {
|
||||
arguments := append([]interface{}{ex1, ex2}, others.([]interface{})...)
|
||||
functionCall, _ := createFunctionCall(parsers.FunctionCallIn, arguments)
|
||||
|
||||
if notIn != nil {
|
||||
return parsers.SelectItem{
|
||||
Type: parsers.SelectItemTypeFunctionCall,
|
||||
Value: functionCall,
|
||||
Invert: true,
|
||||
}, nil
|
||||
}
|
||||
|
||||
return functionCall, nil
|
||||
}
|
||||
|
||||
func (p *parser) callonInFunction24() (any, error) {
|
||||
func (p *parser) callonInFunction29() (any, error) {
|
||||
stack := p.vstack[len(p.vstack)-1]
|
||||
_ = stack
|
||||
return p.cur.onInFunction24(stack["ex1"], stack["ex2"], stack["others"])
|
||||
return p.cur.onInFunction29(stack["ex1"], stack["notIn"], stack["ex2"], stack["others"])
|
||||
}
|
||||
|
||||
func (c *current) onAvgAggregateExpression1(ex any) (any, error) {
|
||||
|
||||
@@ -803,10 +803,33 @@ MathNumberBinExpression <- "NumberBin"i ws "(" ws ex1:SelectItem others:(ws ","
|
||||
MathPiExpression <- "PI"i ws "(" ws ")" { return createFunctionCall(parsers.FunctionCallMathPi, []interface{}{}) }
|
||||
MathRandExpression <- "RAND"i ws "(" ws ")" { return createFunctionCall(parsers.FunctionCallMathRand, []interface{}{}) }
|
||||
|
||||
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{})...))
|
||||
} / "(" 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{})...))
|
||||
InFunction <- ex1:SelectProperty ws notIn:("NOT"i ws)? In ws "(" ws ex2:SelectItem others:(ws "," ws ex:SelectItem { return ex, nil })* ws ")" {
|
||||
arguments := append([]interface{}{ex1, ex2}, others.([]interface{})...)
|
||||
functionCall, _ := createFunctionCall(parsers.FunctionCallIn, arguments)
|
||||
|
||||
if notIn != nil {
|
||||
return parsers.SelectItem{
|
||||
Type: parsers.SelectItemTypeFunctionCall,
|
||||
Value: functionCall,
|
||||
Invert: true,
|
||||
}, nil
|
||||
}
|
||||
|
||||
return functionCall, nil
|
||||
}
|
||||
/ "(" ws ex1:SelectItem ws notIn:("NOT"i ws)? In ws "(" ws ex2:SelectItem others:(ws "," ws ex:SelectItem { return ex, nil })* ws ")" ws ")" {
|
||||
arguments := append([]interface{}{ex1, ex2}, others.([]interface{})...)
|
||||
functionCall, _ := createFunctionCall(parsers.FunctionCallIn, arguments)
|
||||
|
||||
if notIn != nil {
|
||||
return parsers.SelectItem{
|
||||
Type: parsers.SelectItemTypeFunctionCall,
|
||||
Value: functionCall,
|
||||
Invert: true,
|
||||
}, nil
|
||||
}
|
||||
|
||||
return functionCall, nil
|
||||
}
|
||||
|
||||
AvgAggregateExpression <- "AVG"i "(" ws ex:SelectItem ws ")" {
|
||||
|
||||
@@ -149,6 +149,41 @@ func Test_Execute(t *testing.T) {
|
||||
)
|
||||
})
|
||||
|
||||
t.Run("Should execute NOT IN function", func(t *testing.T) {
|
||||
testQueryExecute(
|
||||
t,
|
||||
parsers.SelectStmt{
|
||||
SelectItems: []parsers.SelectItem{
|
||||
{
|
||||
Path: []string{"c", "id"},
|
||||
Type: parsers.SelectItemTypeField,
|
||||
},
|
||||
},
|
||||
Table: parsers.Table{SelectItem: testutils.SelectItem_Path("c")},
|
||||
Filters: parsers.SelectItem{
|
||||
Type: parsers.SelectItemTypeFunctionCall,
|
||||
Invert: true,
|
||||
Value: parsers.FunctionCall{
|
||||
Type: parsers.FunctionCallIn,
|
||||
Arguments: []interface{}{
|
||||
parsers.SelectItem{
|
||||
Path: []string{"c", "id"},
|
||||
Type: parsers.SelectItemTypeField,
|
||||
},
|
||||
testutils.SelectItem_Constant_String("123"),
|
||||
testutils.SelectItem_Constant_String("456"),
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
mockData,
|
||||
[]memoryexecutor.RowType{
|
||||
map[string]interface{}{"id": "12345"},
|
||||
map[string]interface{}{"id": "67890"},
|
||||
},
|
||||
)
|
||||
})
|
||||
|
||||
t.Run("Should execute IN function with function call", func(t *testing.T) {
|
||||
testQueryExecute(
|
||||
t,
|
||||
|
||||
Reference in New Issue
Block a user