mirror of
https://github.com/pikami/cosmium.git
synced 2026-01-31 15:22:58 +00:00
Compare commits
8 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
3daba9d0eb | ||
|
|
d3d238fa98 | ||
|
|
cae6fda95c | ||
|
|
46c446c273 | ||
|
|
d64bdeb385 | ||
|
|
11f3a1ad01 | ||
|
|
4d67212f1b | ||
|
|
03cd04e996 |
60
.github/workflows/compile-shared-libraries.yml
vendored
60
.github/workflows/compile-shared-libraries.yml
vendored
@@ -7,6 +7,9 @@ jobs:
|
|||||||
build:
|
build:
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
|
|
||||||
|
outputs:
|
||||||
|
artifact: shared-libraries
|
||||||
|
|
||||||
steps:
|
steps:
|
||||||
- name: Checkout code
|
- name: Checkout code
|
||||||
uses: actions/checkout@v3
|
uses: actions/checkout@v3
|
||||||
@@ -15,7 +18,7 @@ jobs:
|
|||||||
uses: crazy-max/ghaction-xgo@e22d3c8b089adba750d5a74738b8e95d96f0c991 # v3.1.0
|
uses: crazy-max/ghaction-xgo@e22d3c8b089adba750d5a74738b8e95d96f0c991 # v3.1.0
|
||||||
with:
|
with:
|
||||||
xgo_version: latest
|
xgo_version: latest
|
||||||
go_version: 1.25.1
|
go_version: 1.24.7
|
||||||
dest: dist
|
dest: dist
|
||||||
pkg: sharedlibrary
|
pkg: sharedlibrary
|
||||||
prefix: cosmium
|
prefix: cosmium
|
||||||
@@ -29,3 +32,58 @@ jobs:
|
|||||||
with:
|
with:
|
||||||
name: shared-libraries
|
name: shared-libraries
|
||||||
path: dist/*
|
path: dist/*
|
||||||
|
|
||||||
|
test:
|
||||||
|
needs: build
|
||||||
|
runs-on: ${{ matrix.os }}
|
||||||
|
strategy:
|
||||||
|
fail-fast: false
|
||||||
|
matrix:
|
||||||
|
include:
|
||||||
|
- os: ubuntu-latest
|
||||||
|
lib_ext: amd64.so
|
||||||
|
- os: windows-latest
|
||||||
|
lib_ext: amd64.dll
|
||||||
|
- os: macos-latest
|
||||||
|
lib_ext: arm64.dylib
|
||||||
|
|
||||||
|
steps:
|
||||||
|
- uses: actions/checkout@v3
|
||||||
|
|
||||||
|
- name: Download shared libraries
|
||||||
|
uses: actions/download-artifact@v4
|
||||||
|
with:
|
||||||
|
name: shared-libraries
|
||||||
|
path: libs
|
||||||
|
|
||||||
|
- name: Install MinGW (GCC) on Windows
|
||||||
|
if: runner.os == 'Windows'
|
||||||
|
run: choco install mingw --no-progress
|
||||||
|
|
||||||
|
- name: Build test loader (Windows)
|
||||||
|
if: runner.os == 'Windows'
|
||||||
|
run: |
|
||||||
|
mkdir build
|
||||||
|
gcc -Wall -o build/test_loader.exe sharedlibrary/tests/*.c
|
||||||
|
|
||||||
|
- name: Build test loader (Unix)
|
||||||
|
if: runner.os != 'Windows'
|
||||||
|
run: |
|
||||||
|
mkdir build
|
||||||
|
gcc -Wall -ldl -o build/test_loader sharedlibrary/tests/*.c
|
||||||
|
|
||||||
|
- name: Run test (Unix)
|
||||||
|
if: runner.os != 'Windows'
|
||||||
|
run: |
|
||||||
|
LIB=$(ls libs/*${{ matrix.lib_ext }} | head -n 1)
|
||||||
|
echo "Testing library: $LIB"
|
||||||
|
chmod +x build/test_loader
|
||||||
|
./build/test_loader "$LIB"
|
||||||
|
|
||||||
|
- name: Run test (Windows)
|
||||||
|
if: runner.os == 'Windows'
|
||||||
|
shell: pwsh
|
||||||
|
run: |
|
||||||
|
$lib = Get-ChildItem "libs/*${{ matrix.lib_ext }}" | Select-Object -First 1
|
||||||
|
Write-Host "Testing library: $($lib.FullName)"
|
||||||
|
.\build\test_loader.exe $lib.FullName
|
||||||
|
|||||||
4
.github/workflows/release.yml
vendored
4
.github/workflows/release.yml
vendored
@@ -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.25.1
|
go-version: 1.24.7
|
||||||
|
|
||||||
- name: Cross-Compile with xgo
|
- name: Cross-Compile with xgo
|
||||||
uses: crazy-max/ghaction-xgo@e22d3c8b089adba750d5a74738b8e95d96f0c991 # v3.1.0
|
uses: crazy-max/ghaction-xgo@e22d3c8b089adba750d5a74738b8e95d96f0c991 # v3.1.0
|
||||||
with:
|
with:
|
||||||
xgo_version: latest
|
xgo_version: latest
|
||||||
go_version: 1.25.1
|
go_version: 1.24.7
|
||||||
dest: sharedlibrary_dist
|
dest: sharedlibrary_dist
|
||||||
pkg: sharedlibrary
|
pkg: sharedlibrary
|
||||||
prefix: cosmium
|
prefix: cosmium
|
||||||
|
|||||||
2
Makefile
2
Makefile
@@ -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.25.1
|
GOVERSION=1.24.7
|
||||||
|
|
||||||
DIST_DIR=dist
|
DIST_DIR=dist
|
||||||
|
|
||||||
|
|||||||
@@ -11,6 +11,7 @@ import (
|
|||||||
apimodels "github.com/pikami/cosmium/api/api_models"
|
apimodels "github.com/pikami/cosmium/api/api_models"
|
||||||
"github.com/pikami/cosmium/api/headers"
|
"github.com/pikami/cosmium/api/headers"
|
||||||
"github.com/pikami/cosmium/internal/constants"
|
"github.com/pikami/cosmium/internal/constants"
|
||||||
|
continuationtoken "github.com/pikami/cosmium/internal/continuation_token"
|
||||||
"github.com/pikami/cosmium/internal/converters"
|
"github.com/pikami/cosmium/internal/converters"
|
||||||
"github.com/pikami/cosmium/internal/datastore"
|
"github.com/pikami/cosmium/internal/datastore"
|
||||||
"github.com/pikami/cosmium/internal/logger"
|
"github.com/pikami/cosmium/internal/logger"
|
||||||
@@ -262,20 +263,50 @@ func (h *Handlers) handleDocumentQuery(c *gin.Context, requestBody map[string]in
|
|||||||
queryParameters = parametersToMap(paramsArray)
|
queryParameters = parametersToMap(paramsArray)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
collection, collectionStatus := h.dataStore.GetCollection(databaseId, collectionId)
|
||||||
|
if collectionStatus == datastore.StatusNotFound {
|
||||||
|
c.IndentedJSON(http.StatusNotFound, constants.NotFoundResponse)
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
if collectionStatus != datastore.StatusOk {
|
||||||
|
c.IndentedJSON(http.StatusInternalServerError, constants.UnknownErrorResponse)
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
continuationToken := continuationtoken.GenerateDefault(collection.ResourceID)
|
||||||
|
continuationTokenHeader := c.GetHeader(headers.ContinuationToken)
|
||||||
|
if continuationTokenHeader != "" {
|
||||||
|
continuationToken = continuationtoken.FromString(continuationTokenHeader)
|
||||||
|
}
|
||||||
|
|
||||||
|
pageMaxItemCount, maxItemCountError := strconv.Atoi(c.GetHeader(headers.MaxItemCount))
|
||||||
|
if maxItemCountError != nil {
|
||||||
|
pageMaxItemCount = 1000
|
||||||
|
}
|
||||||
|
|
||||||
queryText := requestBody["query"].(string)
|
queryText := requestBody["query"].(string)
|
||||||
docs, status := h.executeQueryDocuments(databaseId, collectionId, queryText, queryParameters)
|
executeQueryResult, status := h.executeQueryDocuments(
|
||||||
|
databaseId, collectionId, queryText, queryParameters, pageMaxItemCount, continuationToken.Token.TotalResults)
|
||||||
if status != datastore.StatusOk {
|
if status != datastore.StatusOk {
|
||||||
// TODO: Currently we return everything if the query fails
|
// TODO: Currently we return everything if the query fails
|
||||||
|
logger.Infof("Query failed: %s", queryText)
|
||||||
h.GetAllDocuments(c)
|
h.GetAllDocuments(c)
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
collection, _ := h.dataStore.GetCollection(databaseId, collectionId)
|
resultCount := len(executeQueryResult.Rows)
|
||||||
c.Header(headers.ItemCount, fmt.Sprintf("%d", len(docs)))
|
if executeQueryResult.HasMorePages {
|
||||||
|
nextContinuationToken := continuationtoken.Generate(
|
||||||
|
collection.ResourceID, continuationToken.Token.PageIndex+1, continuationToken.Token.TotalResults+resultCount)
|
||||||
|
c.Header(headers.ContinuationToken, nextContinuationToken.ToString())
|
||||||
|
}
|
||||||
|
|
||||||
|
c.Header(headers.ItemCount, fmt.Sprintf("%d", resultCount))
|
||||||
c.IndentedJSON(http.StatusOK, gin.H{
|
c.IndentedJSON(http.StatusOK, gin.H{
|
||||||
"_rid": collection.ResourceID,
|
"_rid": collection.ResourceID,
|
||||||
"Documents": docs,
|
"Documents": executeQueryResult.Rows,
|
||||||
"_count": len(docs),
|
"_count": resultCount,
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -377,16 +408,23 @@ func dataStoreStatusToResponseCode(status datastore.DataStoreStatus) int {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
func (h *Handlers) executeQueryDocuments(databaseId string, collectionId string, query string, queryParameters map[string]interface{}) ([]memoryexecutor.RowType, datastore.DataStoreStatus) {
|
func (h *Handlers) executeQueryDocuments(
|
||||||
|
databaseId string,
|
||||||
|
collectionId string,
|
||||||
|
query string,
|
||||||
|
queryParameters map[string]interface{},
|
||||||
|
pageMaxItemCount int,
|
||||||
|
pageCursor int,
|
||||||
|
) (memoryexecutor.ExecuteQueryResult, datastore.DataStoreStatus) {
|
||||||
parsedQuery, err := nosql.Parse("", []byte(query))
|
parsedQuery, err := nosql.Parse("", []byte(query))
|
||||||
if err != nil {
|
if err != nil {
|
||||||
logger.Errorf("Failed to parse query: %s\nerr: %v", query, err)
|
logger.Errorf("Failed to parse query: %s\nerr: %v", query, err)
|
||||||
return nil, datastore.BadRequest
|
return memoryexecutor.ExecuteQueryResult{}, datastore.BadRequest
|
||||||
}
|
}
|
||||||
|
|
||||||
allDocumentsIterator, status := h.dataStore.GetDocumentIterator(databaseId, collectionId)
|
allDocumentsIterator, status := h.dataStore.GetDocumentIterator(databaseId, collectionId)
|
||||||
if status != datastore.StatusOk {
|
if status != datastore.StatusOk {
|
||||||
return nil, status
|
return memoryexecutor.ExecuteQueryResult{}, status
|
||||||
}
|
}
|
||||||
defer allDocumentsIterator.Close()
|
defer allDocumentsIterator.Close()
|
||||||
|
|
||||||
@@ -394,8 +432,8 @@ func (h *Handlers) executeQueryDocuments(databaseId string, collectionId string,
|
|||||||
|
|
||||||
if typedQuery, ok := parsedQuery.(parsers.SelectStmt); ok {
|
if typedQuery, ok := parsedQuery.(parsers.SelectStmt); ok {
|
||||||
typedQuery.Parameters = queryParameters
|
typedQuery.Parameters = queryParameters
|
||||||
return memoryexecutor.ExecuteQuery(typedQuery, rowsIterator), datastore.StatusOk
|
return memoryexecutor.ExecuteQuery(typedQuery, rowsIterator, pageCursor, pageMaxItemCount), datastore.StatusOk
|
||||||
}
|
}
|
||||||
|
|
||||||
return nil, datastore.BadRequest
|
return memoryexecutor.ExecuteQueryResult{}, datastore.BadRequest
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -13,6 +13,8 @@ const (
|
|||||||
ItemCount = "x-ms-item-count"
|
ItemCount = "x-ms-item-count"
|
||||||
LSN = "lsn"
|
LSN = "lsn"
|
||||||
XDate = "x-ms-date"
|
XDate = "x-ms-date"
|
||||||
|
MaxItemCount = "x-ms-max-item-count"
|
||||||
|
ContinuationToken = "x-ms-continuation"
|
||||||
|
|
||||||
// Kinda retarded, but what can I do ¯\_(ツ)_/¯
|
// Kinda retarded, but what can I do ¯\_(ツ)_/¯
|
||||||
IsQuery = "x-ms-documentdb-isquery" // Sent from python sdk and web explorer
|
IsQuery = "x-ms-documentdb-isquery" // Sent from python sdk and web explorer
|
||||||
|
|||||||
@@ -121,5 +121,26 @@ func Test_Collections(t *testing.T) {
|
|||||||
panic(err)
|
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)
|
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")
|
||||||
|
})
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -14,6 +14,7 @@ import (
|
|||||||
"github.com/Azure/azure-sdk-for-go/sdk/azcore"
|
"github.com/Azure/azure-sdk-for-go/sdk/azcore"
|
||||||
"github.com/Azure/azure-sdk-for-go/sdk/data/azcosmos"
|
"github.com/Azure/azure-sdk-for-go/sdk/data/azcosmos"
|
||||||
"github.com/pikami/cosmium/api/config"
|
"github.com/pikami/cosmium/api/config"
|
||||||
|
continuationtoken "github.com/pikami/cosmium/internal/continuation_token"
|
||||||
"github.com/pikami/cosmium/internal/datastore"
|
"github.com/pikami/cosmium/internal/datastore"
|
||||||
"github.com/stretchr/testify/assert"
|
"github.com/stretchr/testify/assert"
|
||||||
)
|
)
|
||||||
@@ -425,7 +426,7 @@ func Test_Documents(t *testing.T) {
|
|||||||
assert.Equal(t, int32(http.StatusNoContent), operationResponse.StatusCode)
|
assert.Equal(t, int32(http.StatusNoContent), operationResponse.StatusCode)
|
||||||
|
|
||||||
_, status := ts.DataStore.GetDocument(testDatabaseName, testCollectionName, "12345")
|
_, 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) {
|
t.Run("Should execute REPLACE transactional batch", func(t *testing.T) {
|
||||||
@@ -512,4 +513,46 @@ func Test_Documents(t *testing.T) {
|
|||||||
assert.Equal(t, "67890", itemResponseBody["id"])
|
assert.Equal(t, "67890", itemResponseBody["id"])
|
||||||
})
|
})
|
||||||
})
|
})
|
||||||
|
|
||||||
|
runTestsWithPresets(t, "Test_Documents_With_Continuation_Token", presets, func(t *testing.T, ts *TestServer, client *azcosmos.Client) {
|
||||||
|
collectionClient := documents_InitializeDb(t, ts)
|
||||||
|
|
||||||
|
t.Run("Should query document with continuation token", func(t *testing.T) {
|
||||||
|
context := context.TODO()
|
||||||
|
pager := collectionClient.NewQueryItemsPager(
|
||||||
|
"SELECT c.id, c[\"pk\"] FROM c ORDER BY c.id",
|
||||||
|
azcosmos.PartitionKey{},
|
||||||
|
&azcosmos.QueryOptions{
|
||||||
|
PageSizeHint: 1,
|
||||||
|
})
|
||||||
|
|
||||||
|
assert.True(t, pager.More())
|
||||||
|
|
||||||
|
firstResponse, err := pager.NextPage(context)
|
||||||
|
assert.Nil(t, err)
|
||||||
|
assert.Equal(t, 1, len(firstResponse.Items))
|
||||||
|
var firstItem map[string]interface{}
|
||||||
|
err = json.Unmarshal(firstResponse.Items[0], &firstItem)
|
||||||
|
assert.Nil(t, err)
|
||||||
|
assert.Equal(t, "12345", firstItem["id"])
|
||||||
|
assert.Equal(t, "123", firstItem["pk"])
|
||||||
|
|
||||||
|
firstContinuationToken := continuationtoken.FromString(*firstResponse.ContinuationToken)
|
||||||
|
assert.Equal(t, 1, firstContinuationToken.Token.PageIndex)
|
||||||
|
assert.Equal(t, 1, firstContinuationToken.Token.TotalResults)
|
||||||
|
|
||||||
|
assert.True(t, pager.More())
|
||||||
|
secondResponse, err := pager.NextPage(context)
|
||||||
|
assert.Nil(t, err)
|
||||||
|
assert.Equal(t, 1, len(secondResponse.Items))
|
||||||
|
var secondItem map[string]interface{}
|
||||||
|
err = json.Unmarshal(secondResponse.Items[0], &secondItem)
|
||||||
|
assert.Nil(t, err)
|
||||||
|
assert.Equal(t, "67890", secondItem["id"])
|
||||||
|
assert.Equal(t, "456", secondItem["pk"])
|
||||||
|
assert.Nil(t, secondResponse.ContinuationToken)
|
||||||
|
|
||||||
|
assert.False(t, pager.More())
|
||||||
|
})
|
||||||
|
})
|
||||||
}
|
}
|
||||||
|
|||||||
50
go.mod
50
go.mod
@@ -1,41 +1,42 @@
|
|||||||
module github.com/pikami/cosmium
|
module github.com/pikami/cosmium
|
||||||
|
|
||||||
go 1.25.1
|
go 1.24.7
|
||||||
|
|
||||||
require (
|
require (
|
||||||
github.com/Azure/azure-sdk-for-go/sdk/azcore v1.19.1
|
github.com/Azure/azure-sdk-for-go/sdk/azcore v1.21.0
|
||||||
github.com/Azure/azure-sdk-for-go/sdk/data/azcosmos v1.4.1
|
github.com/Azure/azure-sdk-for-go/sdk/data/azcosmos v1.4.2
|
||||||
github.com/cosmiumdev/json-patch/v5 v5.9.11
|
github.com/cosmiumdev/json-patch/v5 v5.9.11
|
||||||
github.com/dgraph-io/badger/v4 v4.8.0
|
github.com/dgraph-io/badger/v4 v4.9.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/google/uuid v1.6.0
|
||||||
github.com/stretchr/testify v1.11.1
|
github.com/stretchr/testify v1.11.1
|
||||||
github.com/vmihailenco/msgpack/v5 v5.4.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-20260112195511-716be5621a96
|
||||||
)
|
)
|
||||||
|
|
||||||
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.11.2 // indirect
|
github.com/Azure/azure-sdk-for-go/sdk/internal v1.11.2 // indirect
|
||||||
github.com/bytedance/gopkg v0.1.3 // indirect
|
github.com/bytedance/gopkg v0.1.3 // indirect
|
||||||
github.com/bytedance/sonic v1.14.1 // indirect
|
github.com/bytedance/sonic v1.15.0 // indirect
|
||||||
github.com/bytedance/sonic/loader v0.3.0 // indirect
|
github.com/bytedance/sonic/loader v0.5.0 // indirect
|
||||||
github.com/cespare/xxhash/v2 v2.3.0 // indirect
|
github.com/cespare/xxhash/v2 v2.3.0 // indirect
|
||||||
github.com/cloudwego/base64x v0.1.6 // indirect
|
github.com/cloudwego/base64x v0.1.6 // indirect
|
||||||
github.com/davecgh/go-spew v1.1.1 // indirect
|
github.com/davecgh/go-spew v1.1.1 // indirect
|
||||||
github.com/dgraph-io/ristretto/v2 v2.3.0 // indirect
|
github.com/dgraph-io/ristretto/v2 v2.4.0 // indirect
|
||||||
github.com/dustin/go-humanize v1.0.1 // indirect
|
github.com/dustin/go-humanize v1.0.1 // indirect
|
||||||
github.com/gabriel-vasile/mimetype v1.4.10 // indirect
|
github.com/gabriel-vasile/mimetype v1.4.12 // indirect
|
||||||
github.com/gin-contrib/sse v1.1.0 // indirect
|
github.com/gin-contrib/sse v1.1.0 // indirect
|
||||||
github.com/go-logr/logr v1.4.3 // indirect
|
github.com/go-logr/logr v1.4.3 // indirect
|
||||||
github.com/go-logr/stdr v1.2.2 // indirect
|
github.com/go-logr/stdr v1.2.2 // 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.27.0 // indirect
|
github.com/go-playground/validator/v10 v10.30.1 // indirect
|
||||||
github.com/goccy/go-json v0.10.5 // 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.19.2 // indirect
|
||||||
|
github.com/google/flatbuffers v25.12.19+incompatible // indirect
|
||||||
github.com/json-iterator/go v1.1.12 // indirect
|
github.com/json-iterator/go v1.1.12 // indirect
|
||||||
github.com/klauspost/compress v1.18.0 // indirect
|
github.com/klauspost/compress v1.18.3 // indirect
|
||||||
github.com/klauspost/cpuid/v2 v2.3.0 // indirect
|
github.com/klauspost/cpuid/v2 v2.3.0 // indirect
|
||||||
github.com/leodido/go-urn v1.4.0 // indirect
|
github.com/leodido/go-urn v1.4.0 // indirect
|
||||||
github.com/mattn/go-isatty v0.0.20 // indirect
|
github.com/mattn/go-isatty v0.0.20 // indirect
|
||||||
@@ -43,18 +44,21 @@ require (
|
|||||||
github.com/modern-go/reflect2 v1.0.2 // indirect
|
github.com/modern-go/reflect2 v1.0.2 // indirect
|
||||||
github.com/pelletier/go-toml/v2 v2.2.4 // indirect
|
github.com/pelletier/go-toml/v2 v2.2.4 // indirect
|
||||||
github.com/pmezard/go-difflib v1.0.0 // indirect
|
github.com/pmezard/go-difflib v1.0.0 // indirect
|
||||||
|
github.com/quic-go/qpack v0.6.0 // indirect
|
||||||
|
github.com/quic-go/quic-go v0.59.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.3.0 // indirect
|
github.com/ugorji/go/codec v1.3.1 // indirect
|
||||||
github.com/vmihailenco/tagparser/v2 v2.0.0 // indirect
|
github.com/vmihailenco/tagparser/v2 v2.0.0 // indirect
|
||||||
go.opentelemetry.io/auto/sdk v1.2.1 // indirect
|
go.opentelemetry.io/auto/sdk v1.2.1 // indirect
|
||||||
go.opentelemetry.io/otel v1.38.0 // indirect
|
go.opentelemetry.io/otel v1.39.0 // indirect
|
||||||
go.opentelemetry.io/otel/metric v1.38.0 // indirect
|
go.opentelemetry.io/otel/metric v1.39.0 // indirect
|
||||||
go.opentelemetry.io/otel/trace v1.38.0 // indirect
|
go.opentelemetry.io/otel/trace v1.39.0 // indirect
|
||||||
golang.org/x/arch v0.21.0 // indirect
|
go.uber.org/mock v0.6.0 // indirect
|
||||||
golang.org/x/crypto v0.42.0 // indirect
|
golang.org/x/arch v0.23.0 // indirect
|
||||||
golang.org/x/net v0.44.0 // indirect
|
golang.org/x/crypto v0.47.0 // indirect
|
||||||
golang.org/x/sys v0.36.0 // indirect
|
golang.org/x/net v0.49.0 // indirect
|
||||||
golang.org/x/text v0.29.0 // indirect
|
golang.org/x/sys v0.40.0 // indirect
|
||||||
google.golang.org/protobuf v1.36.9 // indirect
|
golang.org/x/text v0.33.0 // indirect
|
||||||
|
google.golang.org/protobuf v1.36.11 // indirect
|
||||||
gopkg.in/yaml.v3 v3.0.1 // indirect
|
gopkg.in/yaml.v3 v3.0.1 // indirect
|
||||||
)
|
)
|
||||||
|
|||||||
100
go.sum
100
go.sum
@@ -1,21 +1,21 @@
|
|||||||
github.com/Azure/azure-sdk-for-go v68.0.0+incompatible h1:fcYLmCpyNYRnvJbPerq7U0hS+6+I79yEDJBqVNcqUzU=
|
github.com/Azure/azure-sdk-for-go v68.0.0+incompatible h1:fcYLmCpyNYRnvJbPerq7U0hS+6+I79yEDJBqVNcqUzU=
|
||||||
github.com/Azure/azure-sdk-for-go v68.0.0+incompatible/go.mod h1:9XXNKU+eRnpl9moKnB4QOLf1HestfXbmab5FXxiDBjc=
|
github.com/Azure/azure-sdk-for-go v68.0.0+incompatible/go.mod h1:9XXNKU+eRnpl9moKnB4QOLf1HestfXbmab5FXxiDBjc=
|
||||||
github.com/Azure/azure-sdk-for-go/sdk/azcore v1.19.1 h1:5YTBM8QDVIBN3sxBil89WfdAAqDZbyJTgh688DSxX5w=
|
github.com/Azure/azure-sdk-for-go/sdk/azcore v1.21.0 h1:fou+2+WFTib47nS+nz/ozhEBnvU96bKHy6LjRsY4E28=
|
||||||
github.com/Azure/azure-sdk-for-go/sdk/azcore v1.19.1/go.mod h1:YD5h/ldMsG0XiIw7PdyNhLxaM317eFh5yNLccNfGdyw=
|
github.com/Azure/azure-sdk-for-go/sdk/azcore v1.21.0/go.mod h1:t76Ruy8AHvUAC8GfMWJMa0ElSbuIcO03NLpynfbgsPA=
|
||||||
github.com/Azure/azure-sdk-for-go/sdk/azidentity v1.10.1 h1:B+blDbyVIG3WaikNxPnhPiJ1MThR03b3vKGtER95TP4=
|
github.com/Azure/azure-sdk-for-go/sdk/azidentity v1.10.1 h1:B+blDbyVIG3WaikNxPnhPiJ1MThR03b3vKGtER95TP4=
|
||||||
github.com/Azure/azure-sdk-for-go/sdk/azidentity v1.10.1/go.mod h1:JdM5psgjfBf5fo2uWOZhflPWyDBZ/O/CNAH9CtsuZE4=
|
github.com/Azure/azure-sdk-for-go/sdk/azidentity v1.10.1/go.mod h1:JdM5psgjfBf5fo2uWOZhflPWyDBZ/O/CNAH9CtsuZE4=
|
||||||
github.com/Azure/azure-sdk-for-go/sdk/data/azcosmos v1.4.1 h1:ToPLhnXvatKVN4ZkcxLOwcXOJhdu4iQl8w0efeuDz9Y=
|
github.com/Azure/azure-sdk-for-go/sdk/data/azcosmos v1.4.2 h1:zqxnp53f5Jn5PFU5Av4mvyWEbZ7whg72AoOCEzlXFKc=
|
||||||
github.com/Azure/azure-sdk-for-go/sdk/data/azcosmos v1.4.1/go.mod h1:Krtog/7tz27z75TwM5cIS8bxEH4dcBUezcq+kGVeZEo=
|
github.com/Azure/azure-sdk-for-go/sdk/data/azcosmos v1.4.2/go.mod h1:Krtog/7tz27z75TwM5cIS8bxEH4dcBUezcq+kGVeZEo=
|
||||||
github.com/Azure/azure-sdk-for-go/sdk/internal v1.11.2 h1:9iefClla7iYpfYWdzPCRDozdmndjTm8DXdpCzPajMgA=
|
github.com/Azure/azure-sdk-for-go/sdk/internal v1.11.2 h1:9iefClla7iYpfYWdzPCRDozdmndjTm8DXdpCzPajMgA=
|
||||||
github.com/Azure/azure-sdk-for-go/sdk/internal v1.11.2/go.mod h1:XtLgD3ZD34DAaVIIAyG3objl5DynM3CQ/vMcbBNJZGI=
|
github.com/Azure/azure-sdk-for-go/sdk/internal v1.11.2/go.mod h1:XtLgD3ZD34DAaVIIAyG3objl5DynM3CQ/vMcbBNJZGI=
|
||||||
github.com/AzureAD/microsoft-authentication-library-for-go v1.4.2 h1:oygO0locgZJe7PpYPXT5A29ZkwJaPqcva7BVeemZOZs=
|
github.com/AzureAD/microsoft-authentication-library-for-go v1.4.2 h1:oygO0locgZJe7PpYPXT5A29ZkwJaPqcva7BVeemZOZs=
|
||||||
github.com/AzureAD/microsoft-authentication-library-for-go v1.4.2/go.mod h1:wP83P5OoQ5p6ip3ScPr0BAq0BvuPAvacpEuSzyouqAI=
|
github.com/AzureAD/microsoft-authentication-library-for-go v1.4.2/go.mod h1:wP83P5OoQ5p6ip3ScPr0BAq0BvuPAvacpEuSzyouqAI=
|
||||||
github.com/bytedance/gopkg v0.1.3 h1:TPBSwH8RsouGCBcMBktLt1AymVo2TVsBVCY4b6TnZ/M=
|
github.com/bytedance/gopkg v0.1.3 h1:TPBSwH8RsouGCBcMBktLt1AymVo2TVsBVCY4b6TnZ/M=
|
||||||
github.com/bytedance/gopkg v0.1.3/go.mod h1:576VvJ+eJgyCzdjS+c4+77QF3p7ubbtiKARP3TxducM=
|
github.com/bytedance/gopkg v0.1.3/go.mod h1:576VvJ+eJgyCzdjS+c4+77QF3p7ubbtiKARP3TxducM=
|
||||||
github.com/bytedance/sonic v1.14.1 h1:FBMC0zVz5XUmE4z9wF4Jey0An5FueFvOsTKKKtwIl7w=
|
github.com/bytedance/sonic v1.15.0 h1:/PXeWFaR5ElNcVE84U0dOHjiMHQOwNIx3K4ymzh/uSE=
|
||||||
github.com/bytedance/sonic v1.14.1/go.mod h1:gi6uhQLMbTdeP0muCnrjHLeCUPyb70ujhnNlhOylAFc=
|
github.com/bytedance/sonic v1.15.0/go.mod h1:tFkWrPz0/CUCLEF4ri4UkHekCIcdnkqXw9VduqpJh0k=
|
||||||
github.com/bytedance/sonic/loader v0.3.0 h1:dskwH8edlzNMctoruo8FPTJDF3vLtDT0sXZwvZJyqeA=
|
github.com/bytedance/sonic/loader v0.5.0 h1:gXH3KVnatgY7loH5/TkeVyXPfESoqSBSBEiDd5VjlgE=
|
||||||
github.com/bytedance/sonic/loader v0.3.0/go.mod h1:N8A3vUdtUebEY2/VQC0MyhYeKUFosQU6FxH2JmUe6VI=
|
github.com/bytedance/sonic/loader v0.5.0/go.mod h1:AR4NYCk5DdzZizZ5djGqQ92eEhCCcdf5x77udYiSJRo=
|
||||||
github.com/cespare/xxhash/v2 v2.3.0 h1:UL815xU9SqsFlibzuggzjXhog7bL6oX9BbNZnL2UFvs=
|
github.com/cespare/xxhash/v2 v2.3.0 h1:UL815xU9SqsFlibzuggzjXhog7bL6oX9BbNZnL2UFvs=
|
||||||
github.com/cespare/xxhash/v2 v2.3.0/go.mod h1:VGX0DQ3Q6kWi7AoAeZDth3/j3BFtOZR5XLFGgcrjCOs=
|
github.com/cespare/xxhash/v2 v2.3.0/go.mod h1:VGX0DQ3Q6kWi7AoAeZDth3/j3BFtOZR5XLFGgcrjCOs=
|
||||||
github.com/cloudwego/base64x v0.1.6 h1:t11wG9AECkCDk5fMSoxmufanudBtJ+/HemLstXDLI2M=
|
github.com/cloudwego/base64x v0.1.6 h1:t11wG9AECkCDk5fMSoxmufanudBtJ+/HemLstXDLI2M=
|
||||||
@@ -25,20 +25,20 @@ github.com/cosmiumdev/json-patch/v5 v5.9.11/go.mod h1:YPZmckmv4ZY+oxKIOjgq3sIudH
|
|||||||
github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
|
github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
|
||||||
github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c=
|
github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c=
|
||||||
github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
|
github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
|
||||||
github.com/dgraph-io/badger/v4 v4.8.0 h1:JYph1ChBijCw8SLeybvPINizbDKWZ5n/GYbz2yhN/bs=
|
github.com/dgraph-io/badger/v4 v4.9.0 h1:tpqWb0NewSrCYqTvywbcXOhQdWcqephkVkbBmaaqHzc=
|
||||||
github.com/dgraph-io/badger/v4 v4.8.0/go.mod h1:U6on6e8k/RTbUWxqKR0MvugJuVmkxSNc79ap4917h4w=
|
github.com/dgraph-io/badger/v4 v4.9.0/go.mod h1:5/MEx97uzdPUHR4KtkNt8asfI2T4JiEiQlV7kWUo8c0=
|
||||||
github.com/dgraph-io/ristretto/v2 v2.3.0 h1:qTQ38m7oIyd4GAed/QkUZyPFNMnvVWyazGXRwvOt5zk=
|
github.com/dgraph-io/ristretto/v2 v2.4.0 h1:I/w09yLjhdcVD2QV192UJcq8dPBaAJb9pOuMyNy0XlU=
|
||||||
github.com/dgraph-io/ristretto/v2 v2.3.0/go.mod h1:gpoRV3VzrEY1a9dWAYV6T1U7YzfgttXdd/ZzL1s9OZM=
|
github.com/dgraph-io/ristretto/v2 v2.4.0/go.mod h1:0KsrXtXvnv0EqnzyowllbVJB8yBonswa2lTCK2gGo9E=
|
||||||
github.com/dgryski/go-farm v0.0.0-20240924180020-3414d57e47da h1:aIftn67I1fkbMa512G+w+Pxci9hJPB8oMnkcP3iZF38=
|
github.com/dgryski/go-farm v0.0.0-20240924180020-3414d57e47da h1:aIftn67I1fkbMa512G+w+Pxci9hJPB8oMnkcP3iZF38=
|
||||||
github.com/dgryski/go-farm v0.0.0-20240924180020-3414d57e47da/go.mod h1:SqUrOPUnsFjfmXRMNPybcSiG0BgUW2AuFH8PAnS2iTw=
|
github.com/dgryski/go-farm v0.0.0-20240924180020-3414d57e47da/go.mod h1:SqUrOPUnsFjfmXRMNPybcSiG0BgUW2AuFH8PAnS2iTw=
|
||||||
github.com/dustin/go-humanize v1.0.1 h1:GzkhY7T5VNhEkwH0PVJgjz+fX1rhBrR7pRT3mDkpeCY=
|
github.com/dustin/go-humanize v1.0.1 h1:GzkhY7T5VNhEkwH0PVJgjz+fX1rhBrR7pRT3mDkpeCY=
|
||||||
github.com/dustin/go-humanize v1.0.1/go.mod h1:Mu1zIs6XwVuF/gI1OepvI0qD18qycQx+mFykh5fBlto=
|
github.com/dustin/go-humanize v1.0.1/go.mod h1:Mu1zIs6XwVuF/gI1OepvI0qD18qycQx+mFykh5fBlto=
|
||||||
github.com/gabriel-vasile/mimetype v1.4.10 h1:zyueNbySn/z8mJZHLt6IPw0KoZsiQNszIpU+bX4+ZK0=
|
github.com/gabriel-vasile/mimetype v1.4.12 h1:e9hWvmLYvtp846tLHam2o++qitpguFiYCKbn0w9jyqw=
|
||||||
github.com/gabriel-vasile/mimetype v1.4.10/go.mod h1:d+9Oxyo1wTzWdyVUPMmXFvp4F9tea18J8ufA774AB3s=
|
github.com/gabriel-vasile/mimetype v1.4.12/go.mod h1:d+9Oxyo1wTzWdyVUPMmXFvp4F9tea18J8ufA774AB3s=
|
||||||
github.com/gin-contrib/sse v1.1.0 h1:n0w2GMuUpWDVp7qSpvze6fAu9iRxJY4Hmj6AmBOU05w=
|
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-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.11.0 h1:OW/6PLjyusp2PPXtyxKHU0RbX6I/l28FTdDlae5ueWk=
|
||||||
github.com/gin-gonic/gin v1.10.1/go.mod h1:4PMNQiOhvDRa013RKVbsiNwoyezlm2rm0uX/T7kzp5Y=
|
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.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 h1:CjnDlHq8ikf6E492q6eKboGOC0T8CDaOvkHCIg8idEI=
|
||||||
github.com/go-logr/logr v1.4.3/go.mod h1:9T104GzyrTigFIr8wt5mBrctHMim0Nb2HLGrmQ40KvY=
|
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/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.27.0 h1:w8+XrWVMhGkxOaaowyKH35gFydVHOvC0/uWoy2Fzwn4=
|
github.com/go-playground/validator/v10 v10.30.1 h1:f3zDSN/zOma+w6+1Wswgd9fLkdwy06ntQJp0BBvFG0w=
|
||||||
github.com/go-playground/validator/v10 v10.27.0/go.mod h1:I5QpIEbmr8On7W0TktmJAumgzX4CA1XNl4ZmDuVHKKo=
|
github.com/go-playground/validator/v10 v10.30.1/go.mod h1:oSuBIQzuJxL//3MelwSLD5hc2Tu889bF0Idm9Dg26cM=
|
||||||
github.com/goccy/go-json v0.10.5 h1:Fq85nIqj+gXn/S5ahsiTlK3TmC85qgirsdTP/+DeaC4=
|
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-json v0.10.5/go.mod h1:oq7eo15ShAhp70Anwd5lgX2pLfOS3QCiwU/PULtXL6M=
|
||||||
|
github.com/goccy/go-yaml v1.19.2 h1:PmFC1S6h8ljIz6gMRBopkjP1TVT7xuwrButHID66PoM=
|
||||||
|
github.com/goccy/go-yaml v1.19.2/go.mod h1:XBurs7gK8ATbW4ZPGKgcbrY1Br56PdM69F7LkFRi1kA=
|
||||||
github.com/golang-jwt/jwt/v5 v5.2.2 h1:Rl4B7itRWVtYIHFrSNd7vhTiz9UpLdi6gZhZ3wEeDy8=
|
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/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.12.19+incompatible h1:haMV2JRRJCe1998HeW/p0X9UaMTK6SDo0ffLn2+DbLs=
|
||||||
github.com/google/flatbuffers v25.2.10+incompatible/go.mod h1:1AeVuKshWv4vARoZatz6mlQ0JxURH0Kv5+zNeJKJCa8=
|
github.com/google/flatbuffers v25.12.19+incompatible/go.mod h1:1AeVuKshWv4vARoZatz6mlQ0JxURH0Kv5+zNeJKJCa8=
|
||||||
github.com/google/go-cmp v0.7.0 h1:wk8382ETsv4JYUZwIsn6YpYiWiBsYLSJiTsyBybVuN8=
|
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/go-cmp v0.7.0/go.mod h1:pXiqmnSA92OHEEa9HXL2W4E7lf9JzCmGVUdgjX3N/iU=
|
||||||
github.com/google/gofuzz v1.0.0/go.mod h1:dBl0BpW6vV/+mYPU4Po3pmUjxk6FQPldtuIdl/M65Eg=
|
github.com/google/gofuzz v1.0.0/go.mod h1:dBl0BpW6vV/+mYPU4Po3pmUjxk6FQPldtuIdl/M65Eg=
|
||||||
@@ -65,8 +67,8 @@ github.com/google/uuid v1.6.0 h1:NIvaJDMOsjHA8n1jAhLSgzrAzy1Hgr+hNrb57e+94F0=
|
|||||||
github.com/google/uuid v1.6.0/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo=
|
github.com/google/uuid v1.6.0/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo=
|
||||||
github.com/json-iterator/go v1.1.12 h1:PV8peI4a0ysnczrg+LtxykD8LfKY9ML6u2jnxaEnrnM=
|
github.com/json-iterator/go v1.1.12 h1:PV8peI4a0ysnczrg+LtxykD8LfKY9ML6u2jnxaEnrnM=
|
||||||
github.com/json-iterator/go v1.1.12/go.mod h1:e30LSqwooZae/UwlEbR2852Gd8hjQvJoHmT4TnhNGBo=
|
github.com/json-iterator/go v1.1.12/go.mod h1:e30LSqwooZae/UwlEbR2852Gd8hjQvJoHmT4TnhNGBo=
|
||||||
github.com/klauspost/compress v1.18.0 h1:c/Cqfb0r+Yi+JtIEq73FWXVkRonBlf0CRNYc8Zttxdo=
|
github.com/klauspost/compress v1.18.3 h1:9PJRvfbmTabkOX8moIpXPbMMbYN60bWImDDU7L+/6zw=
|
||||||
github.com/klauspost/compress v1.18.0/go.mod h1:2Pp+KzxcywXVXMr50+X0Q/Lsb43OQHYWRCY2AiWywWQ=
|
github.com/klauspost/compress v1.18.3/go.mod h1:R0h/fSBs8DE4ENlcrlib3PsXS61voFxhIs2DeRhCvJ4=
|
||||||
github.com/klauspost/cpuid/v2 v2.3.0 h1:S4CRMLnYUhGeDFDqkGriYKdfoFlDnMtqTiI/sFzhA9Y=
|
github.com/klauspost/cpuid/v2 v2.3.0 h1:S4CRMLnYUhGeDFDqkGriYKdfoFlDnMtqTiI/sFzhA9Y=
|
||||||
github.com/klauspost/cpuid/v2 v2.3.0/go.mod h1:hqwkgyIinND0mEev00jJYCxPNVRVXFQeu1XKlok6oO0=
|
github.com/klauspost/cpuid/v2 v2.3.0/go.mod h1:hqwkgyIinND0mEev00jJYCxPNVRVXFQeu1XKlok6oO0=
|
||||||
github.com/kr/pretty v0.3.1 h1:flRD4NNwYAUpkphVc1HcthR4KEIFJ65n8Mw5qdRn3LE=
|
github.com/kr/pretty v0.3.1 h1:flRD4NNwYAUpkphVc1HcthR4KEIFJ65n8Mw5qdRn3LE=
|
||||||
@@ -90,48 +92,56 @@ 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/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 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM=
|
||||||
github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4=
|
github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4=
|
||||||
|
github.com/quic-go/qpack v0.6.0 h1:g7W+BMYynC1LbYLSqRt8PBg5Tgwxn214ZZR34VIOjz8=
|
||||||
|
github.com/quic-go/qpack v0.6.0/go.mod h1:lUpLKChi8njB4ty2bFLX2x4gzDqXwUpaO1DP9qMDZII=
|
||||||
|
github.com/quic-go/quic-go v0.59.0 h1:OLJkp1Mlm/aS7dpKgTc6cnpynnD2Xg7C1pwL6vy/SAw=
|
||||||
|
github.com/quic-go/quic-go v0.59.0/go.mod h1:upnsH4Ju1YkqpLXC305eW3yDZ4NfnNbmQRCMWS58IKU=
|
||||||
github.com/rogpeppe/go-internal v1.14.1 h1:UQB4HGPB6osV0SQTLymcB4TgvyWu6ZyliaW0tI/otEQ=
|
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/rogpeppe/go-internal v1.14.1/go.mod h1:MaRKkUm5W0goXpeCfT7UZI6fk/L7L7so1lCWt35ZSgc=
|
||||||
github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME=
|
github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME=
|
||||||
github.com/stretchr/objx v0.4.0/go.mod h1:YvHI0jy2hoMjB+UWwv71VJQ9isScKT/TqJzVSSt89Yw=
|
github.com/stretchr/objx v0.4.0/go.mod h1:YvHI0jy2hoMjB+UWwv71VJQ9isScKT/TqJzVSSt89Yw=
|
||||||
github.com/stretchr/objx v0.5.0/go.mod h1:Yh+to48EsGEfYuaHDzXPcE3xhTkx73EhmCGUpEOglKo=
|
github.com/stretchr/objx v0.5.0/go.mod h1:Yh+to48EsGEfYuaHDzXPcE3xhTkx73EhmCGUpEOglKo=
|
||||||
|
github.com/stretchr/objx v0.5.2/go.mod h1:FRsXN1f5AsAjCGJKqEizvkpNtU+EGNCLh3NxZ/8L+MA=
|
||||||
github.com/stretchr/testify v1.3.0/go.mod h1:M5WIy9Dh21IEIfnGCwXGc5bZfKNJtfHm1UVUgZn+9EI=
|
github.com/stretchr/testify v1.3.0/go.mod h1:M5WIy9Dh21IEIfnGCwXGc5bZfKNJtfHm1UVUgZn+9EI=
|
||||||
github.com/stretchr/testify v1.7.1/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg=
|
github.com/stretchr/testify v1.7.1/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg=
|
||||||
github.com/stretchr/testify v1.8.0/go.mod h1:yNjHg4UonilssWZ8iaSj1OCr/vHnekPRkoO+kdMU+MU=
|
github.com/stretchr/testify v1.8.0/go.mod h1:yNjHg4UonilssWZ8iaSj1OCr/vHnekPRkoO+kdMU+MU=
|
||||||
github.com/stretchr/testify v1.8.1/go.mod h1:w2LPCIKwWwSfY2zedu0+kehJoqGctiVI29o6fzry7u4=
|
github.com/stretchr/testify v1.8.4/go.mod h1:sz/lmYIOXD/1dqDmKjjqLyZ2RngseejIcXlSw2iwfAo=
|
||||||
|
github.com/stretchr/testify v1.10.0/go.mod h1:r2ic/lqez/lEtzL7wO/rwa5dbSLXVDPFyf8C91i36aY=
|
||||||
github.com/stretchr/testify v1.11.1 h1:7s2iGBzp5EwR7/aIZr8ao5+dra3wiQyKjjFuvgVKu7U=
|
github.com/stretchr/testify v1.11.1 h1:7s2iGBzp5EwR7/aIZr8ao5+dra3wiQyKjjFuvgVKu7U=
|
||||||
github.com/stretchr/testify v1.11.1/go.mod h1:wZwfW3scLgRK+23gO65QZefKpKQRnfz6sD981Nm4B6U=
|
github.com/stretchr/testify v1.11.1/go.mod h1:wZwfW3scLgRK+23gO65QZefKpKQRnfz6sD981Nm4B6U=
|
||||||
github.com/twitchyliquid64/golang-asm v0.15.1 h1:SU5vSMR7hnwNxj24w34ZyCi/FmDZTkS4MhqMhdFk5YI=
|
github.com/twitchyliquid64/golang-asm v0.15.1 h1:SU5vSMR7hnwNxj24w34ZyCi/FmDZTkS4MhqMhdFk5YI=
|
||||||
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.3.0 h1:Qd2W2sQawAfG8XSvzwhBeoGq71zXOC/Q1E9y/wUcsUA=
|
github.com/ugorji/go/codec v1.3.1 h1:waO7eEiFDwidsBN6agj1vJQ4AG7lh2yqXyOXqhgQuyY=
|
||||||
github.com/ugorji/go/codec v1.3.0/go.mod h1:pRBVtBSKl77K30Bv8R2P+cLSGaTtex6fsA2Wjqmfxj4=
|
github.com/ugorji/go/codec v1.3.1/go.mod h1:pRBVtBSKl77K30Bv8R2P+cLSGaTtex6fsA2Wjqmfxj4=
|
||||||
github.com/vmihailenco/msgpack/v5 v5.4.1 h1:cQriyiUvjTwOHg8QZaPihLWeRAAVoCpE00IUPn0Bjt8=
|
github.com/vmihailenco/msgpack/v5 v5.4.1 h1:cQriyiUvjTwOHg8QZaPihLWeRAAVoCpE00IUPn0Bjt8=
|
||||||
github.com/vmihailenco/msgpack/v5 v5.4.1/go.mod h1:GaZTsDaehaPpQVyxrf5mtQlH+pc21PIudVV/E3rRQok=
|
github.com/vmihailenco/msgpack/v5 v5.4.1/go.mod h1:GaZTsDaehaPpQVyxrf5mtQlH+pc21PIudVV/E3rRQok=
|
||||||
github.com/vmihailenco/tagparser/v2 v2.0.0 h1:y09buUbR+b5aycVFQs/g70pqKVZNBmxwAhO7/IwNM9g=
|
github.com/vmihailenco/tagparser/v2 v2.0.0 h1:y09buUbR+b5aycVFQs/g70pqKVZNBmxwAhO7/IwNM9g=
|
||||||
github.com/vmihailenco/tagparser/v2 v2.0.0/go.mod h1:Wri+At7QHww0WTrCBeu4J6bNtoV6mEfg5OIWRZA9qds=
|
github.com/vmihailenco/tagparser/v2 v2.0.0/go.mod h1:Wri+At7QHww0WTrCBeu4J6bNtoV6mEfg5OIWRZA9qds=
|
||||||
go.opentelemetry.io/auto/sdk v1.2.1 h1:jXsnJ4Lmnqd11kwkBV2LgLoFMZKizbCi5fNZ/ipaZ64=
|
go.opentelemetry.io/auto/sdk v1.2.1 h1:jXsnJ4Lmnqd11kwkBV2LgLoFMZKizbCi5fNZ/ipaZ64=
|
||||||
go.opentelemetry.io/auto/sdk v1.2.1/go.mod h1:KRTj+aOaElaLi+wW1kO/DZRXwkF4C5xPbEe3ZiIhN7Y=
|
go.opentelemetry.io/auto/sdk v1.2.1/go.mod h1:KRTj+aOaElaLi+wW1kO/DZRXwkF4C5xPbEe3ZiIhN7Y=
|
||||||
go.opentelemetry.io/otel v1.38.0 h1:RkfdswUDRimDg0m2Az18RKOsnI8UDzppJAtj01/Ymk8=
|
go.opentelemetry.io/otel v1.39.0 h1:8yPrr/S0ND9QEfTfdP9V+SiwT4E0G7Y5MO7p85nis48=
|
||||||
go.opentelemetry.io/otel v1.38.0/go.mod h1:zcmtmQ1+YmQM9wrNsTGV/q/uyusom3P8RxwExxkZhjM=
|
go.opentelemetry.io/otel v1.39.0/go.mod h1:kLlFTywNWrFyEdH0oj2xK0bFYZtHRYUdv1NklR/tgc8=
|
||||||
go.opentelemetry.io/otel/metric v1.38.0 h1:Kl6lzIYGAh5M159u9NgiRkmoMKjvbsKtYRwgfrA6WpA=
|
go.opentelemetry.io/otel/metric v1.39.0 h1:d1UzonvEZriVfpNKEVmHXbdf909uGTOQjA0HF0Ls5Q0=
|
||||||
go.opentelemetry.io/otel/metric v1.38.0/go.mod h1:kB5n/QoRM8YwmUahxvI3bO34eVtQf2i4utNVLr9gEmI=
|
go.opentelemetry.io/otel/metric v1.39.0/go.mod h1:jrZSWL33sD7bBxg1xjrqyDjnuzTUB0x1nBERXd7Ftcs=
|
||||||
go.opentelemetry.io/otel/trace v1.38.0 h1:Fxk5bKrDZJUH+AMyyIXGcFAPah0oRcT+LuNtJrmcNLE=
|
go.opentelemetry.io/otel/trace v1.39.0 h1:2d2vfpEDmCJ5zVYz7ijaJdOF59xLomrvj7bjt6/qCJI=
|
||||||
go.opentelemetry.io/otel/trace v1.38.0/go.mod h1:j1P9ivuFsTceSWe1oY+EeW3sc+Pp42sO++GHkg4wwhs=
|
go.opentelemetry.io/otel/trace v1.39.0/go.mod h1:88w4/PnZSazkGzz/w84VHpQafiU4EtqqlVdxWy+rNOA=
|
||||||
golang.org/x/arch v0.21.0 h1:iTC9o7+wP6cPWpDWkivCvQFGAHDQ59SrSxsLPcnkArw=
|
go.uber.org/mock v0.6.0 h1:hyF9dfmbgIX5EfOdasqLsWD6xqpNZlXblLB/Dbnwv3Y=
|
||||||
golang.org/x/arch v0.21.0/go.mod h1:dNHoOeKiyja7GTvF9NJS1l3Z2yntpQNzgrjh1cU103A=
|
go.uber.org/mock v0.6.0/go.mod h1:KiVJ4BqZJaMj4svdfmHM0AUx4NJYO8ZNpPnZn1Z+BBU=
|
||||||
golang.org/x/crypto v0.42.0 h1:chiH31gIWm57EkTXpwnqf8qeuMUi0yekh6mT2AvFlqI=
|
golang.org/x/arch v0.23.0 h1:lKF64A2jF6Zd8L0knGltUnegD62JMFBiCPBmQpToHhg=
|
||||||
golang.org/x/crypto v0.42.0/go.mod h1:4+rDnOTJhQCx2q7/j6rAN5XDw8kPjeaXEUR2eL94ix8=
|
golang.org/x/arch v0.23.0/go.mod h1:dNHoOeKiyja7GTvF9NJS1l3Z2yntpQNzgrjh1cU103A=
|
||||||
golang.org/x/exp v0.0.0-20250911091902-df9299821621 h1:2id6c1/gto0kaHYyrixvknJ8tUK/Qs5IsmBtrc+FtgU=
|
golang.org/x/crypto v0.47.0 h1:V6e3FRj+n4dbpw86FJ8Fv7XVOql7TEwpHapKoMJ/GO8=
|
||||||
golang.org/x/exp v0.0.0-20250911091902-df9299821621/go.mod h1:TwQYMMnGpvZyc+JpB/UAuTNIsVJifOlSkrZkhcvpVUk=
|
golang.org/x/crypto v0.47.0/go.mod h1:ff3Y9VzzKbwSSEzWqJsJVBnWmRwRSHt/6Op5n9bQc4A=
|
||||||
golang.org/x/net v0.44.0 h1:evd8IRDyfNBMBTTY5XRF1vaZlD+EmWx6x8PkhR04H/I=
|
golang.org/x/exp v0.0.0-20260112195511-716be5621a96 h1:Z/6YuSHTLOHfNFdb8zVZomZr7cqNgTJvA8+Qz75D8gU=
|
||||||
golang.org/x/net v0.44.0/go.mod h1:ECOoLqd5U3Lhyeyo/QDCEVQ4sNgYsqvCZ722XogGieY=
|
golang.org/x/exp v0.0.0-20260112195511-716be5621a96/go.mod h1:nzimsREAkjBCIEFtHiYkrJyT+2uy9YZJB7H1k68CXZU=
|
||||||
|
golang.org/x/net v0.49.0 h1:eeHFmOGUTtaaPSGNmjBKpbng9MulQsJURQUAfUwY++o=
|
||||||
|
golang.org/x/net v0.49.0/go.mod h1:/ysNB2EvaqvesRkuLAyjI1ycPZlQHM3q01F02UY/MV8=
|
||||||
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.36.0 h1:KVRy2GtZBrk1cBYA7MKu5bEZFxQk4NIDV6RLVcC8o0k=
|
golang.org/x/sys v0.40.0 h1:DBZZqJ2Rkml6QMQsZywtnjnnGvHza6BTfYFWY9kjEWQ=
|
||||||
golang.org/x/sys v0.36.0/go.mod h1:OgkHotnGiDImocRcuBABYBEXf8A9a87e/uXjp9XT3ks=
|
golang.org/x/sys v0.40.0/go.mod h1:OgkHotnGiDImocRcuBABYBEXf8A9a87e/uXjp9XT3ks=
|
||||||
golang.org/x/text v0.29.0 h1:1neNs90w9YzJ9BocxfsQNHKuAT4pkghyXc4nhZ6sJvk=
|
golang.org/x/text v0.33.0 h1:B3njUFyqtHDUI5jMn1YIr5B0IE2U0qck04r6d4KPAxE=
|
||||||
golang.org/x/text v0.29.0/go.mod h1:7MhJOA9CD2qZyOKYazxdYMF85OwPdEr9jTtBpO7ydH4=
|
golang.org/x/text v0.33.0/go.mod h1:LuMebE6+rBincTi9+xWTY8TztLzKHc/9C1uBCG27+q8=
|
||||||
google.golang.org/protobuf v1.36.9 h1:w2gp2mA27hUeUzj9Ex9FBjsBm40zfaDtEWow293U7Iw=
|
google.golang.org/protobuf v1.36.11 h1:fV6ZwhNocDyBLK0dj+fg8ektcVegBBuEolpbTQyBNVE=
|
||||||
google.golang.org/protobuf v1.36.9/go.mod h1:fuxRtAxBytpl4zzqUh6/eyUujkJdNiuEkXntxiD/uRU=
|
google.golang.org/protobuf v1.36.11/go.mod h1:HTf+CrKn2C3g5S8VImy6tdcUvCska2kB7j23XfzDpco=
|
||||||
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=
|
||||||
|
|||||||
145
internal/continuation_token/continuation_token.go
Normal file
145
internal/continuation_token/continuation_token.go
Normal file
@@ -0,0 +1,145 @@
|
|||||||
|
package continuationtoken
|
||||||
|
|
||||||
|
import (
|
||||||
|
"encoding/json"
|
||||||
|
"fmt"
|
||||||
|
"strconv"
|
||||||
|
"strings"
|
||||||
|
|
||||||
|
"github.com/pikami/cosmium/internal/logger"
|
||||||
|
)
|
||||||
|
|
||||||
|
type ContinuationTokenExternal struct {
|
||||||
|
Token string `json:"token"`
|
||||||
|
Range struct {
|
||||||
|
Min string `json:"min"`
|
||||||
|
Max string `json:"max"`
|
||||||
|
} `json:"range"`
|
||||||
|
}
|
||||||
|
|
||||||
|
type ContinuationToken struct {
|
||||||
|
Token struct {
|
||||||
|
ResourceId string // RID
|
||||||
|
PageIndex int // RT
|
||||||
|
TotalResults int // TRC
|
||||||
|
ISV int // ISV
|
||||||
|
IEO int // IEO
|
||||||
|
QCF int // QCF
|
||||||
|
LR int // LR
|
||||||
|
}
|
||||||
|
Range struct {
|
||||||
|
Min string
|
||||||
|
Max string
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
func Generate(resourceid string, pageIndex int, totalResults int) ContinuationToken {
|
||||||
|
ct := ContinuationToken{}
|
||||||
|
ct.Token.ResourceId = resourceid
|
||||||
|
ct.Token.PageIndex = pageIndex
|
||||||
|
ct.Token.TotalResults = totalResults
|
||||||
|
ct.Token.ISV = 2
|
||||||
|
ct.Token.IEO = 65567
|
||||||
|
ct.Token.QCF = 8
|
||||||
|
ct.Token.LR = 1
|
||||||
|
ct.Range.Min = ""
|
||||||
|
ct.Range.Max = "FF"
|
||||||
|
|
||||||
|
return ct
|
||||||
|
}
|
||||||
|
|
||||||
|
func GenerateDefault(resourceid string) ContinuationToken {
|
||||||
|
return Generate(resourceid, 0, 0)
|
||||||
|
}
|
||||||
|
|
||||||
|
func (ct *ContinuationToken) ToString() string {
|
||||||
|
token := fmt.Sprintf(
|
||||||
|
"-RID:~%s#RT:%d#TRC:%d#ISV:%d#IEO:%d#QCF:%d#LR:%d",
|
||||||
|
ct.Token.ResourceId,
|
||||||
|
ct.Token.PageIndex,
|
||||||
|
ct.Token.TotalResults,
|
||||||
|
ct.Token.ISV,
|
||||||
|
ct.Token.IEO,
|
||||||
|
ct.Token.QCF,
|
||||||
|
ct.Token.LR,
|
||||||
|
)
|
||||||
|
|
||||||
|
ect := ContinuationTokenExternal{}
|
||||||
|
ect.Token = token
|
||||||
|
ect.Range.Min = ct.Range.Min
|
||||||
|
ect.Range.Max = ct.Range.Max
|
||||||
|
|
||||||
|
json, err := json.Marshal(ect)
|
||||||
|
if err != nil {
|
||||||
|
logger.Error(err, "failed to marshal continuation token")
|
||||||
|
return ""
|
||||||
|
}
|
||||||
|
|
||||||
|
return string(json)
|
||||||
|
}
|
||||||
|
|
||||||
|
func FromString(token string) ContinuationToken {
|
||||||
|
ect := ContinuationTokenExternal{}
|
||||||
|
err := json.Unmarshal([]byte(token), &ect)
|
||||||
|
if err != nil {
|
||||||
|
logger.Error(err, "failed to unmarshal continuation token")
|
||||||
|
return ContinuationToken{}
|
||||||
|
}
|
||||||
|
|
||||||
|
ct, err := parseContinuationToken(ect.Token, ect.Range.Min, ect.Range.Max)
|
||||||
|
if err != nil {
|
||||||
|
logger.Error(err, "failed to parse continuation token")
|
||||||
|
return ContinuationToken{}
|
||||||
|
}
|
||||||
|
|
||||||
|
return *ct
|
||||||
|
}
|
||||||
|
|
||||||
|
func parseContinuationToken(token string, minRange string, maxRange string) (*ContinuationToken, error) {
|
||||||
|
const prefix = "-RID:~"
|
||||||
|
if !strings.HasPrefix(token, prefix) {
|
||||||
|
return nil, fmt.Errorf("invalid token prefix")
|
||||||
|
}
|
||||||
|
|
||||||
|
parts := strings.Split(token[len(prefix):], "#")
|
||||||
|
if len(parts) != 7 {
|
||||||
|
return nil, fmt.Errorf("invalid token format: expected 7 fields, got %d", len(parts))
|
||||||
|
}
|
||||||
|
|
||||||
|
ct := &ContinuationToken{}
|
||||||
|
|
||||||
|
ct.Token.ResourceId = parts[0]
|
||||||
|
|
||||||
|
parseIntField := func(part, key string) (int, error) {
|
||||||
|
if !strings.HasPrefix(part, key+":") {
|
||||||
|
return 0, fmt.Errorf("expected %s field", key)
|
||||||
|
}
|
||||||
|
return strconv.Atoi(strings.TrimPrefix(part, key+":"))
|
||||||
|
}
|
||||||
|
|
||||||
|
var err error
|
||||||
|
|
||||||
|
if ct.Token.PageIndex, err = parseIntField(parts[1], "RT"); err != nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
if ct.Token.TotalResults, err = parseIntField(parts[2], "TRC"); err != nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
if ct.Token.ISV, err = parseIntField(parts[3], "ISV"); err != nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
if ct.Token.IEO, err = parseIntField(parts[4], "IEO"); err != nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
if ct.Token.QCF, err = parseIntField(parts[5], "QCF"); err != nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
if ct.Token.LR, err = parseIntField(parts[6], "LR"); err != nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
|
||||||
|
ct.Range.Min = minRange
|
||||||
|
ct.Range.Max = maxRange
|
||||||
|
|
||||||
|
return ct, nil
|
||||||
|
}
|
||||||
35
internal/continuation_token/continuation_token_test.go
Normal file
35
internal/continuation_token/continuation_token_test.go
Normal file
@@ -0,0 +1,35 @@
|
|||||||
|
package continuationtoken
|
||||||
|
|
||||||
|
import (
|
||||||
|
"testing"
|
||||||
|
|
||||||
|
"github.com/stretchr/testify/assert"
|
||||||
|
)
|
||||||
|
|
||||||
|
func Test_Generate(t *testing.T) {
|
||||||
|
token := Generate("test-resource-id", 1, 100)
|
||||||
|
|
||||||
|
assert.Equal(t, "test-resource-id", token.Token.ResourceId)
|
||||||
|
assert.Equal(t, 1, token.Token.PageIndex)
|
||||||
|
assert.Equal(t, 100, token.Token.TotalResults)
|
||||||
|
}
|
||||||
|
|
||||||
|
func Test_FromString(t *testing.T) {
|
||||||
|
token := FromString("{\"token\":\"-RID:~test-resource-id#RT:1#TRC:100#ISV:2#IEO:65567#QCF:8#LR:1\",\"range\":{\"min\":\"\",\"max\":\"FF\"}}")
|
||||||
|
|
||||||
|
assert.Equal(t, "test-resource-id", token.Token.ResourceId)
|
||||||
|
assert.Equal(t, 1, token.Token.PageIndex)
|
||||||
|
assert.Equal(t, 100, token.Token.TotalResults)
|
||||||
|
}
|
||||||
|
|
||||||
|
func Test_ToString(t *testing.T) {
|
||||||
|
token := Generate("test-resource-id", 1, 100)
|
||||||
|
assert.Equal(t, "{\"token\":\"-RID:~test-resource-id#RT:1#TRC:100#ISV:2#IEO:65567#QCF:8#LR:1\",\"range\":{\"min\":\"\",\"max\":\"FF\"}}", token.ToString())
|
||||||
|
}
|
||||||
|
|
||||||
|
func Test_GenerateDefault(t *testing.T) {
|
||||||
|
token := GenerateDefault("test-resource-id")
|
||||||
|
assert.Equal(t, "test-resource-id", token.Token.ResourceId)
|
||||||
|
assert.Equal(t, 0, token.Token.PageIndex)
|
||||||
|
assert.Equal(t, 0, token.Token.TotalResults)
|
||||||
|
}
|
||||||
@@ -54,7 +54,6 @@ func (r *BadgerDataStore) DeleteCollection(databaseId string, collectionId strin
|
|||||||
generateKey(resourceid.ResourceTypeTrigger, databaseId, collectionId, "") + "/",
|
generateKey(resourceid.ResourceTypeTrigger, databaseId, collectionId, "") + "/",
|
||||||
generateKey(resourceid.ResourceTypeStoredProcedure, databaseId, collectionId, "") + "/",
|
generateKey(resourceid.ResourceTypeStoredProcedure, databaseId, collectionId, "") + "/",
|
||||||
generateKey(resourceid.ResourceTypeUserDefinedFunction, databaseId, collectionId, "") + "/",
|
generateKey(resourceid.ResourceTypeUserDefinedFunction, databaseId, collectionId, "") + "/",
|
||||||
collectionKey,
|
|
||||||
}
|
}
|
||||||
for _, prefix := range prefixes {
|
for _, prefix := range prefixes {
|
||||||
if err := deleteKeysByPrefix(txn, prefix); err != nil {
|
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()
|
err := txn.Commit()
|
||||||
if err != nil {
|
if err != nil {
|
||||||
logger.ErrorLn("Error while committing transaction:", err)
|
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.ResourceTypeTrigger, id, "", "") + "/",
|
||||||
generateKey(resourceid.ResourceTypeStoredProcedure, id, "", "") + "/",
|
generateKey(resourceid.ResourceTypeStoredProcedure, id, "", "") + "/",
|
||||||
generateKey(resourceid.ResourceTypeUserDefinedFunction, id, "", "") + "/",
|
generateKey(resourceid.ResourceTypeUserDefinedFunction, id, "", "") + "/",
|
||||||
databaseKey,
|
|
||||||
}
|
}
|
||||||
for _, prefix := range prefixes {
|
for _, prefix := range prefixes {
|
||||||
if err := deleteKeysByPrefix(txn, prefix); err != nil {
|
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()
|
err := txn.Commit()
|
||||||
if err != nil {
|
if err != nil {
|
||||||
logger.ErrorLn("Error while committing transaction:", err)
|
logger.ErrorLn("Error while committing transaction:", err)
|
||||||
|
|||||||
@@ -202,3 +202,22 @@ func deleteKeysByPrefix(txn *badger.Txn, prefix string) error {
|
|||||||
|
|
||||||
return nil
|
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
|
type DataStoreStatus int
|
||||||
|
|
||||||
const (
|
const (
|
||||||
StatusOk = 1
|
StatusOk DataStoreStatus = 1
|
||||||
StatusNotFound = 2
|
StatusNotFound DataStoreStatus = 2
|
||||||
Conflict = 3
|
Conflict DataStoreStatus = 3
|
||||||
BadRequest = 4
|
BadRequest DataStoreStatus = 4
|
||||||
IterEOF = 5
|
IterEOF DataStoreStatus = 5
|
||||||
Unknown = 6
|
Unknown DataStoreStatus = 6
|
||||||
)
|
)
|
||||||
|
|
||||||
type TriggerOperation string
|
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) {
|
t.Run("Should parse IN function with function call", func(t *testing.T) {
|
||||||
testQueryParse(
|
testQueryParse(
|
||||||
t,
|
t,
|
||||||
|
|||||||
@@ -7684,62 +7684,84 @@ var g = &grammar{
|
|||||||
pos: position{line: 806, col: 34, offset: 30528},
|
pos: position{line: 806, col: 34, offset: 30528},
|
||||||
name: "ws",
|
name: "ws",
|
||||||
},
|
},
|
||||||
&ruleRefExpr{
|
&labeledExpr{
|
||||||
pos: position{line: 806, col: 37, offset: 30531},
|
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: 56, offset: 30550},
|
||||||
name: "In",
|
name: "In",
|
||||||
},
|
},
|
||||||
&ruleRefExpr{
|
&ruleRefExpr{
|
||||||
pos: position{line: 806, col: 40, offset: 30534},
|
pos: position{line: 806, col: 59, offset: 30553},
|
||||||
name: "ws",
|
name: "ws",
|
||||||
},
|
},
|
||||||
&litMatcher{
|
&litMatcher{
|
||||||
pos: position{line: 806, col: 43, offset: 30537},
|
pos: position{line: 806, col: 62, offset: 30556},
|
||||||
val: "(",
|
val: "(",
|
||||||
ignoreCase: false,
|
ignoreCase: false,
|
||||||
want: "\"(\"",
|
want: "\"(\"",
|
||||||
},
|
},
|
||||||
&ruleRefExpr{
|
&ruleRefExpr{
|
||||||
pos: position{line: 806, col: 47, offset: 30541},
|
pos: position{line: 806, col: 66, offset: 30560},
|
||||||
name: "ws",
|
name: "ws",
|
||||||
},
|
},
|
||||||
&labeledExpr{
|
&labeledExpr{
|
||||||
pos: position{line: 806, col: 50, offset: 30544},
|
pos: position{line: 806, col: 69, offset: 30563},
|
||||||
label: "ex2",
|
label: "ex2",
|
||||||
expr: &ruleRefExpr{
|
expr: &ruleRefExpr{
|
||||||
pos: position{line: 806, col: 54, offset: 30548},
|
pos: position{line: 806, col: 73, offset: 30567},
|
||||||
name: "SelectItem",
|
name: "SelectItem",
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
&labeledExpr{
|
&labeledExpr{
|
||||||
pos: position{line: 806, col: 65, offset: 30559},
|
pos: position{line: 806, col: 84, offset: 30578},
|
||||||
label: "others",
|
label: "others",
|
||||||
expr: &zeroOrMoreExpr{
|
expr: &zeroOrMoreExpr{
|
||||||
pos: position{line: 806, col: 72, offset: 30566},
|
pos: position{line: 806, col: 91, offset: 30585},
|
||||||
expr: &actionExpr{
|
expr: &actionExpr{
|
||||||
pos: position{line: 806, col: 73, offset: 30567},
|
pos: position{line: 806, col: 92, offset: 30586},
|
||||||
run: (*parser).callonInFunction15,
|
run: (*parser).callonInFunction20,
|
||||||
expr: &seqExpr{
|
expr: &seqExpr{
|
||||||
pos: position{line: 806, col: 73, offset: 30567},
|
pos: position{line: 806, col: 92, offset: 30586},
|
||||||
exprs: []any{
|
exprs: []any{
|
||||||
&ruleRefExpr{
|
&ruleRefExpr{
|
||||||
pos: position{line: 806, col: 73, offset: 30567},
|
pos: position{line: 806, col: 92, offset: 30586},
|
||||||
name: "ws",
|
name: "ws",
|
||||||
},
|
},
|
||||||
&litMatcher{
|
&litMatcher{
|
||||||
pos: position{line: 806, col: 76, offset: 30570},
|
pos: position{line: 806, col: 95, offset: 30589},
|
||||||
val: ",",
|
val: ",",
|
||||||
ignoreCase: false,
|
ignoreCase: false,
|
||||||
want: "\",\"",
|
want: "\",\"",
|
||||||
},
|
},
|
||||||
&ruleRefExpr{
|
&ruleRefExpr{
|
||||||
pos: position{line: 806, col: 80, offset: 30574},
|
pos: position{line: 806, col: 99, offset: 30593},
|
||||||
name: "ws",
|
name: "ws",
|
||||||
},
|
},
|
||||||
&labeledExpr{
|
&labeledExpr{
|
||||||
pos: position{line: 806, col: 83, offset: 30577},
|
pos: position{line: 806, col: 102, offset: 30596},
|
||||||
label: "ex",
|
label: "ex",
|
||||||
expr: &ruleRefExpr{
|
expr: &ruleRefExpr{
|
||||||
pos: position{line: 806, col: 86, offset: 30580},
|
pos: position{line: 806, col: 105, offset: 30599},
|
||||||
name: "SelectItem",
|
name: "SelectItem",
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
@@ -7749,11 +7771,11 @@ var g = &grammar{
|
|||||||
},
|
},
|
||||||
},
|
},
|
||||||
&ruleRefExpr{
|
&ruleRefExpr{
|
||||||
pos: position{line: 806, col: 118, offset: 30612},
|
pos: position{line: 806, col: 137, offset: 30631},
|
||||||
name: "ws",
|
name: "ws",
|
||||||
},
|
},
|
||||||
&litMatcher{
|
&litMatcher{
|
||||||
pos: position{line: 806, col: 121, offset: 30615},
|
pos: position{line: 806, col: 140, offset: 30634},
|
||||||
val: ")",
|
val: ")",
|
||||||
ignoreCase: false,
|
ignoreCase: false,
|
||||||
want: "\")\"",
|
want: "\")\"",
|
||||||
@@ -7762,89 +7784,111 @@ var g = &grammar{
|
|||||||
},
|
},
|
||||||
},
|
},
|
||||||
&actionExpr{
|
&actionExpr{
|
||||||
pos: position{line: 808, col: 5, offset: 30739},
|
pos: position{line: 820, col: 3, offset: 31027},
|
||||||
run: (*parser).callonInFunction24,
|
run: (*parser).callonInFunction29,
|
||||||
expr: &seqExpr{
|
expr: &seqExpr{
|
||||||
pos: position{line: 808, col: 5, offset: 30739},
|
pos: position{line: 820, col: 3, offset: 31027},
|
||||||
exprs: []any{
|
exprs: []any{
|
||||||
&litMatcher{
|
&litMatcher{
|
||||||
pos: position{line: 808, col: 5, offset: 30739},
|
pos: position{line: 820, col: 3, offset: 31027},
|
||||||
val: "(",
|
val: "(",
|
||||||
ignoreCase: false,
|
ignoreCase: false,
|
||||||
want: "\"(\"",
|
want: "\"(\"",
|
||||||
},
|
},
|
||||||
&ruleRefExpr{
|
&ruleRefExpr{
|
||||||
pos: position{line: 808, col: 9, offset: 30743},
|
pos: position{line: 820, col: 7, offset: 31031},
|
||||||
name: "ws",
|
name: "ws",
|
||||||
},
|
},
|
||||||
&labeledExpr{
|
&labeledExpr{
|
||||||
pos: position{line: 808, col: 12, offset: 30746},
|
pos: position{line: 820, col: 10, offset: 31034},
|
||||||
label: "ex1",
|
label: "ex1",
|
||||||
expr: &ruleRefExpr{
|
expr: &ruleRefExpr{
|
||||||
pos: position{line: 808, col: 16, offset: 30750},
|
pos: position{line: 820, col: 14, offset: 31038},
|
||||||
name: "SelectItem",
|
name: "SelectItem",
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
&ruleRefExpr{
|
&ruleRefExpr{
|
||||||
pos: position{line: 808, col: 27, offset: 30761},
|
pos: position{line: 820, col: 25, offset: 31049},
|
||||||
name: "ws",
|
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{
|
&ruleRefExpr{
|
||||||
pos: position{line: 808, col: 30, offset: 30764},
|
pos: position{line: 820, col: 42, offset: 31066},
|
||||||
|
name: "ws",
|
||||||
|
},
|
||||||
|
},
|
||||||
|
},
|
||||||
|
},
|
||||||
|
},
|
||||||
|
&ruleRefExpr{
|
||||||
|
pos: position{line: 820, col: 47, offset: 31071},
|
||||||
name: "In",
|
name: "In",
|
||||||
},
|
},
|
||||||
&ruleRefExpr{
|
&ruleRefExpr{
|
||||||
pos: position{line: 808, col: 33, offset: 30767},
|
pos: position{line: 820, col: 50, offset: 31074},
|
||||||
name: "ws",
|
name: "ws",
|
||||||
},
|
},
|
||||||
&litMatcher{
|
&litMatcher{
|
||||||
pos: position{line: 808, col: 36, offset: 30770},
|
pos: position{line: 820, col: 53, offset: 31077},
|
||||||
val: "(",
|
val: "(",
|
||||||
ignoreCase: false,
|
ignoreCase: false,
|
||||||
want: "\"(\"",
|
want: "\"(\"",
|
||||||
},
|
},
|
||||||
&ruleRefExpr{
|
&ruleRefExpr{
|
||||||
pos: position{line: 808, col: 40, offset: 30774},
|
pos: position{line: 820, col: 57, offset: 31081},
|
||||||
name: "ws",
|
name: "ws",
|
||||||
},
|
},
|
||||||
&labeledExpr{
|
&labeledExpr{
|
||||||
pos: position{line: 808, col: 43, offset: 30777},
|
pos: position{line: 820, col: 60, offset: 31084},
|
||||||
label: "ex2",
|
label: "ex2",
|
||||||
expr: &ruleRefExpr{
|
expr: &ruleRefExpr{
|
||||||
pos: position{line: 808, col: 47, offset: 30781},
|
pos: position{line: 820, col: 64, offset: 31088},
|
||||||
name: "SelectItem",
|
name: "SelectItem",
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
&labeledExpr{
|
&labeledExpr{
|
||||||
pos: position{line: 808, col: 58, offset: 30792},
|
pos: position{line: 820, col: 75, offset: 31099},
|
||||||
label: "others",
|
label: "others",
|
||||||
expr: &zeroOrMoreExpr{
|
expr: &zeroOrMoreExpr{
|
||||||
pos: position{line: 808, col: 65, offset: 30799},
|
pos: position{line: 820, col: 82, offset: 31106},
|
||||||
expr: &actionExpr{
|
expr: &actionExpr{
|
||||||
pos: position{line: 808, col: 66, offset: 30800},
|
pos: position{line: 820, col: 83, offset: 31107},
|
||||||
run: (*parser).callonInFunction39,
|
run: (*parser).callonInFunction49,
|
||||||
expr: &seqExpr{
|
expr: &seqExpr{
|
||||||
pos: position{line: 808, col: 66, offset: 30800},
|
pos: position{line: 820, col: 83, offset: 31107},
|
||||||
exprs: []any{
|
exprs: []any{
|
||||||
&ruleRefExpr{
|
&ruleRefExpr{
|
||||||
pos: position{line: 808, col: 66, offset: 30800},
|
pos: position{line: 820, col: 83, offset: 31107},
|
||||||
name: "ws",
|
name: "ws",
|
||||||
},
|
},
|
||||||
&litMatcher{
|
&litMatcher{
|
||||||
pos: position{line: 808, col: 69, offset: 30803},
|
pos: position{line: 820, col: 86, offset: 31110},
|
||||||
val: ",",
|
val: ",",
|
||||||
ignoreCase: false,
|
ignoreCase: false,
|
||||||
want: "\",\"",
|
want: "\",\"",
|
||||||
},
|
},
|
||||||
&ruleRefExpr{
|
&ruleRefExpr{
|
||||||
pos: position{line: 808, col: 73, offset: 30807},
|
pos: position{line: 820, col: 90, offset: 31114},
|
||||||
name: "ws",
|
name: "ws",
|
||||||
},
|
},
|
||||||
&labeledExpr{
|
&labeledExpr{
|
||||||
pos: position{line: 808, col: 76, offset: 30810},
|
pos: position{line: 820, col: 93, offset: 31117},
|
||||||
label: "ex",
|
label: "ex",
|
||||||
expr: &ruleRefExpr{
|
expr: &ruleRefExpr{
|
||||||
pos: position{line: 808, col: 79, offset: 30813},
|
pos: position{line: 820, col: 96, offset: 31120},
|
||||||
name: "SelectItem",
|
name: "SelectItem",
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
@@ -7854,21 +7898,21 @@ var g = &grammar{
|
|||||||
},
|
},
|
||||||
},
|
},
|
||||||
&ruleRefExpr{
|
&ruleRefExpr{
|
||||||
pos: position{line: 808, col: 111, offset: 30845},
|
pos: position{line: 820, col: 128, offset: 31152},
|
||||||
name: "ws",
|
name: "ws",
|
||||||
},
|
},
|
||||||
&litMatcher{
|
&litMatcher{
|
||||||
pos: position{line: 808, col: 114, offset: 30848},
|
pos: position{line: 820, col: 131, offset: 31155},
|
||||||
val: ")",
|
val: ")",
|
||||||
ignoreCase: false,
|
ignoreCase: false,
|
||||||
want: "\")\"",
|
want: "\")\"",
|
||||||
},
|
},
|
||||||
&ruleRefExpr{
|
&ruleRefExpr{
|
||||||
pos: position{line: 808, col: 118, offset: 30852},
|
pos: position{line: 820, col: 135, offset: 31159},
|
||||||
name: "ws",
|
name: "ws",
|
||||||
},
|
},
|
||||||
&litMatcher{
|
&litMatcher{
|
||||||
pos: position{line: 808, col: 121, offset: 30855},
|
pos: position{line: 820, col: 138, offset: 31162},
|
||||||
val: ")",
|
val: ")",
|
||||||
ignoreCase: false,
|
ignoreCase: false,
|
||||||
want: "\")\"",
|
want: "\")\"",
|
||||||
@@ -7881,43 +7925,43 @@ var g = &grammar{
|
|||||||
},
|
},
|
||||||
{
|
{
|
||||||
name: "AvgAggregateExpression",
|
name: "AvgAggregateExpression",
|
||||||
pos: position{line: 812, col: 1, offset: 30978},
|
pos: position{line: 835, col: 1, offset: 31550},
|
||||||
expr: &actionExpr{
|
expr: &actionExpr{
|
||||||
pos: position{line: 812, col: 29, offset: 31006},
|
pos: position{line: 835, col: 29, offset: 31578},
|
||||||
run: (*parser).callonAvgAggregateExpression1,
|
run: (*parser).callonAvgAggregateExpression1,
|
||||||
expr: &seqExpr{
|
expr: &seqExpr{
|
||||||
pos: position{line: 812, col: 29, offset: 31006},
|
pos: position{line: 835, col: 29, offset: 31578},
|
||||||
exprs: []any{
|
exprs: []any{
|
||||||
&litMatcher{
|
&litMatcher{
|
||||||
pos: position{line: 812, col: 29, offset: 31006},
|
pos: position{line: 835, col: 29, offset: 31578},
|
||||||
val: "avg",
|
val: "avg",
|
||||||
ignoreCase: true,
|
ignoreCase: true,
|
||||||
want: "\"AVG\"i",
|
want: "\"AVG\"i",
|
||||||
},
|
},
|
||||||
&litMatcher{
|
&litMatcher{
|
||||||
pos: position{line: 812, col: 36, offset: 31013},
|
pos: position{line: 835, col: 36, offset: 31585},
|
||||||
val: "(",
|
val: "(",
|
||||||
ignoreCase: false,
|
ignoreCase: false,
|
||||||
want: "\"(\"",
|
want: "\"(\"",
|
||||||
},
|
},
|
||||||
&ruleRefExpr{
|
&ruleRefExpr{
|
||||||
pos: position{line: 812, col: 40, offset: 31017},
|
pos: position{line: 835, col: 40, offset: 31589},
|
||||||
name: "ws",
|
name: "ws",
|
||||||
},
|
},
|
||||||
&labeledExpr{
|
&labeledExpr{
|
||||||
pos: position{line: 812, col: 43, offset: 31020},
|
pos: position{line: 835, col: 43, offset: 31592},
|
||||||
label: "ex",
|
label: "ex",
|
||||||
expr: &ruleRefExpr{
|
expr: &ruleRefExpr{
|
||||||
pos: position{line: 812, col: 46, offset: 31023},
|
pos: position{line: 835, col: 46, offset: 31595},
|
||||||
name: "SelectItem",
|
name: "SelectItem",
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
&ruleRefExpr{
|
&ruleRefExpr{
|
||||||
pos: position{line: 812, col: 58, offset: 31035},
|
pos: position{line: 835, col: 58, offset: 31607},
|
||||||
name: "ws",
|
name: "ws",
|
||||||
},
|
},
|
||||||
&litMatcher{
|
&litMatcher{
|
||||||
pos: position{line: 812, col: 61, offset: 31038},
|
pos: position{line: 835, col: 61, offset: 31610},
|
||||||
val: ")",
|
val: ")",
|
||||||
ignoreCase: false,
|
ignoreCase: false,
|
||||||
want: "\")\"",
|
want: "\")\"",
|
||||||
@@ -7928,43 +7972,43 @@ var g = &grammar{
|
|||||||
},
|
},
|
||||||
{
|
{
|
||||||
name: "CountAggregateExpression",
|
name: "CountAggregateExpression",
|
||||||
pos: position{line: 816, col: 1, offset: 31130},
|
pos: position{line: 839, col: 1, offset: 31702},
|
||||||
expr: &actionExpr{
|
expr: &actionExpr{
|
||||||
pos: position{line: 816, col: 29, offset: 31158},
|
pos: position{line: 839, col: 29, offset: 31730},
|
||||||
run: (*parser).callonCountAggregateExpression1,
|
run: (*parser).callonCountAggregateExpression1,
|
||||||
expr: &seqExpr{
|
expr: &seqExpr{
|
||||||
pos: position{line: 816, col: 29, offset: 31158},
|
pos: position{line: 839, col: 29, offset: 31730},
|
||||||
exprs: []any{
|
exprs: []any{
|
||||||
&litMatcher{
|
&litMatcher{
|
||||||
pos: position{line: 816, col: 29, offset: 31158},
|
pos: position{line: 839, col: 29, offset: 31730},
|
||||||
val: "count",
|
val: "count",
|
||||||
ignoreCase: true,
|
ignoreCase: true,
|
||||||
want: "\"COUNT\"i",
|
want: "\"COUNT\"i",
|
||||||
},
|
},
|
||||||
&litMatcher{
|
&litMatcher{
|
||||||
pos: position{line: 816, col: 38, offset: 31167},
|
pos: position{line: 839, col: 38, offset: 31739},
|
||||||
val: "(",
|
val: "(",
|
||||||
ignoreCase: false,
|
ignoreCase: false,
|
||||||
want: "\"(\"",
|
want: "\"(\"",
|
||||||
},
|
},
|
||||||
&ruleRefExpr{
|
&ruleRefExpr{
|
||||||
pos: position{line: 816, col: 42, offset: 31171},
|
pos: position{line: 839, col: 42, offset: 31743},
|
||||||
name: "ws",
|
name: "ws",
|
||||||
},
|
},
|
||||||
&labeledExpr{
|
&labeledExpr{
|
||||||
pos: position{line: 816, col: 45, offset: 31174},
|
pos: position{line: 839, col: 45, offset: 31746},
|
||||||
label: "ex",
|
label: "ex",
|
||||||
expr: &ruleRefExpr{
|
expr: &ruleRefExpr{
|
||||||
pos: position{line: 816, col: 48, offset: 31177},
|
pos: position{line: 839, col: 48, offset: 31749},
|
||||||
name: "SelectItem",
|
name: "SelectItem",
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
&ruleRefExpr{
|
&ruleRefExpr{
|
||||||
pos: position{line: 816, col: 59, offset: 31188},
|
pos: position{line: 839, col: 59, offset: 31760},
|
||||||
name: "ws",
|
name: "ws",
|
||||||
},
|
},
|
||||||
&litMatcher{
|
&litMatcher{
|
||||||
pos: position{line: 816, col: 62, offset: 31191},
|
pos: position{line: 839, col: 62, offset: 31763},
|
||||||
val: ")",
|
val: ")",
|
||||||
ignoreCase: false,
|
ignoreCase: false,
|
||||||
want: "\")\"",
|
want: "\")\"",
|
||||||
@@ -7975,43 +8019,43 @@ var g = &grammar{
|
|||||||
},
|
},
|
||||||
{
|
{
|
||||||
name: "MaxAggregateExpression",
|
name: "MaxAggregateExpression",
|
||||||
pos: position{line: 820, col: 1, offset: 31285},
|
pos: position{line: 843, col: 1, offset: 31857},
|
||||||
expr: &actionExpr{
|
expr: &actionExpr{
|
||||||
pos: position{line: 820, col: 29, offset: 31313},
|
pos: position{line: 843, col: 29, offset: 31885},
|
||||||
run: (*parser).callonMaxAggregateExpression1,
|
run: (*parser).callonMaxAggregateExpression1,
|
||||||
expr: &seqExpr{
|
expr: &seqExpr{
|
||||||
pos: position{line: 820, col: 29, offset: 31313},
|
pos: position{line: 843, col: 29, offset: 31885},
|
||||||
exprs: []any{
|
exprs: []any{
|
||||||
&litMatcher{
|
&litMatcher{
|
||||||
pos: position{line: 820, col: 29, offset: 31313},
|
pos: position{line: 843, col: 29, offset: 31885},
|
||||||
val: "max",
|
val: "max",
|
||||||
ignoreCase: true,
|
ignoreCase: true,
|
||||||
want: "\"MAX\"i",
|
want: "\"MAX\"i",
|
||||||
},
|
},
|
||||||
&litMatcher{
|
&litMatcher{
|
||||||
pos: position{line: 820, col: 36, offset: 31320},
|
pos: position{line: 843, col: 36, offset: 31892},
|
||||||
val: "(",
|
val: "(",
|
||||||
ignoreCase: false,
|
ignoreCase: false,
|
||||||
want: "\"(\"",
|
want: "\"(\"",
|
||||||
},
|
},
|
||||||
&ruleRefExpr{
|
&ruleRefExpr{
|
||||||
pos: position{line: 820, col: 40, offset: 31324},
|
pos: position{line: 843, col: 40, offset: 31896},
|
||||||
name: "ws",
|
name: "ws",
|
||||||
},
|
},
|
||||||
&labeledExpr{
|
&labeledExpr{
|
||||||
pos: position{line: 820, col: 43, offset: 31327},
|
pos: position{line: 843, col: 43, offset: 31899},
|
||||||
label: "ex",
|
label: "ex",
|
||||||
expr: &ruleRefExpr{
|
expr: &ruleRefExpr{
|
||||||
pos: position{line: 820, col: 46, offset: 31330},
|
pos: position{line: 843, col: 46, offset: 31902},
|
||||||
name: "SelectItem",
|
name: "SelectItem",
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
&ruleRefExpr{
|
&ruleRefExpr{
|
||||||
pos: position{line: 820, col: 57, offset: 31341},
|
pos: position{line: 843, col: 57, offset: 31913},
|
||||||
name: "ws",
|
name: "ws",
|
||||||
},
|
},
|
||||||
&litMatcher{
|
&litMatcher{
|
||||||
pos: position{line: 820, col: 60, offset: 31344},
|
pos: position{line: 843, col: 60, offset: 31916},
|
||||||
val: ")",
|
val: ")",
|
||||||
ignoreCase: false,
|
ignoreCase: false,
|
||||||
want: "\")\"",
|
want: "\")\"",
|
||||||
@@ -8022,43 +8066,43 @@ var g = &grammar{
|
|||||||
},
|
},
|
||||||
{
|
{
|
||||||
name: "MinAggregateExpression",
|
name: "MinAggregateExpression",
|
||||||
pos: position{line: 824, col: 1, offset: 31436},
|
pos: position{line: 847, col: 1, offset: 32008},
|
||||||
expr: &actionExpr{
|
expr: &actionExpr{
|
||||||
pos: position{line: 824, col: 29, offset: 31464},
|
pos: position{line: 847, col: 29, offset: 32036},
|
||||||
run: (*parser).callonMinAggregateExpression1,
|
run: (*parser).callonMinAggregateExpression1,
|
||||||
expr: &seqExpr{
|
expr: &seqExpr{
|
||||||
pos: position{line: 824, col: 29, offset: 31464},
|
pos: position{line: 847, col: 29, offset: 32036},
|
||||||
exprs: []any{
|
exprs: []any{
|
||||||
&litMatcher{
|
&litMatcher{
|
||||||
pos: position{line: 824, col: 29, offset: 31464},
|
pos: position{line: 847, col: 29, offset: 32036},
|
||||||
val: "min",
|
val: "min",
|
||||||
ignoreCase: true,
|
ignoreCase: true,
|
||||||
want: "\"MIN\"i",
|
want: "\"MIN\"i",
|
||||||
},
|
},
|
||||||
&litMatcher{
|
&litMatcher{
|
||||||
pos: position{line: 824, col: 36, offset: 31471},
|
pos: position{line: 847, col: 36, offset: 32043},
|
||||||
val: "(",
|
val: "(",
|
||||||
ignoreCase: false,
|
ignoreCase: false,
|
||||||
want: "\"(\"",
|
want: "\"(\"",
|
||||||
},
|
},
|
||||||
&ruleRefExpr{
|
&ruleRefExpr{
|
||||||
pos: position{line: 824, col: 40, offset: 31475},
|
pos: position{line: 847, col: 40, offset: 32047},
|
||||||
name: "ws",
|
name: "ws",
|
||||||
},
|
},
|
||||||
&labeledExpr{
|
&labeledExpr{
|
||||||
pos: position{line: 824, col: 43, offset: 31478},
|
pos: position{line: 847, col: 43, offset: 32050},
|
||||||
label: "ex",
|
label: "ex",
|
||||||
expr: &ruleRefExpr{
|
expr: &ruleRefExpr{
|
||||||
pos: position{line: 824, col: 46, offset: 31481},
|
pos: position{line: 847, col: 46, offset: 32053},
|
||||||
name: "SelectItem",
|
name: "SelectItem",
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
&ruleRefExpr{
|
&ruleRefExpr{
|
||||||
pos: position{line: 824, col: 57, offset: 31492},
|
pos: position{line: 847, col: 57, offset: 32064},
|
||||||
name: "ws",
|
name: "ws",
|
||||||
},
|
},
|
||||||
&litMatcher{
|
&litMatcher{
|
||||||
pos: position{line: 824, col: 60, offset: 31495},
|
pos: position{line: 847, col: 60, offset: 32067},
|
||||||
val: ")",
|
val: ")",
|
||||||
ignoreCase: false,
|
ignoreCase: false,
|
||||||
want: "\")\"",
|
want: "\")\"",
|
||||||
@@ -8069,43 +8113,43 @@ var g = &grammar{
|
|||||||
},
|
},
|
||||||
{
|
{
|
||||||
name: "SumAggregateExpression",
|
name: "SumAggregateExpression",
|
||||||
pos: position{line: 828, col: 1, offset: 31587},
|
pos: position{line: 851, col: 1, offset: 32159},
|
||||||
expr: &actionExpr{
|
expr: &actionExpr{
|
||||||
pos: position{line: 828, col: 29, offset: 31615},
|
pos: position{line: 851, col: 29, offset: 32187},
|
||||||
run: (*parser).callonSumAggregateExpression1,
|
run: (*parser).callonSumAggregateExpression1,
|
||||||
expr: &seqExpr{
|
expr: &seqExpr{
|
||||||
pos: position{line: 828, col: 29, offset: 31615},
|
pos: position{line: 851, col: 29, offset: 32187},
|
||||||
exprs: []any{
|
exprs: []any{
|
||||||
&litMatcher{
|
&litMatcher{
|
||||||
pos: position{line: 828, col: 29, offset: 31615},
|
pos: position{line: 851, col: 29, offset: 32187},
|
||||||
val: "sum",
|
val: "sum",
|
||||||
ignoreCase: true,
|
ignoreCase: true,
|
||||||
want: "\"SUM\"i",
|
want: "\"SUM\"i",
|
||||||
},
|
},
|
||||||
&litMatcher{
|
&litMatcher{
|
||||||
pos: position{line: 828, col: 36, offset: 31622},
|
pos: position{line: 851, col: 36, offset: 32194},
|
||||||
val: "(",
|
val: "(",
|
||||||
ignoreCase: false,
|
ignoreCase: false,
|
||||||
want: "\"(\"",
|
want: "\"(\"",
|
||||||
},
|
},
|
||||||
&ruleRefExpr{
|
&ruleRefExpr{
|
||||||
pos: position{line: 828, col: 40, offset: 31626},
|
pos: position{line: 851, col: 40, offset: 32198},
|
||||||
name: "ws",
|
name: "ws",
|
||||||
},
|
},
|
||||||
&labeledExpr{
|
&labeledExpr{
|
||||||
pos: position{line: 828, col: 43, offset: 31629},
|
pos: position{line: 851, col: 43, offset: 32201},
|
||||||
label: "ex",
|
label: "ex",
|
||||||
expr: &ruleRefExpr{
|
expr: &ruleRefExpr{
|
||||||
pos: position{line: 828, col: 46, offset: 31632},
|
pos: position{line: 851, col: 46, offset: 32204},
|
||||||
name: "SelectItem",
|
name: "SelectItem",
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
&ruleRefExpr{
|
&ruleRefExpr{
|
||||||
pos: position{line: 828, col: 57, offset: 31643},
|
pos: position{line: 851, col: 57, offset: 32215},
|
||||||
name: "ws",
|
name: "ws",
|
||||||
},
|
},
|
||||||
&litMatcher{
|
&litMatcher{
|
||||||
pos: position{line: 828, col: 60, offset: 31646},
|
pos: position{line: 851, col: 60, offset: 32218},
|
||||||
val: ")",
|
val: ")",
|
||||||
ignoreCase: false,
|
ignoreCase: false,
|
||||||
want: "\")\"",
|
want: "\")\"",
|
||||||
@@ -8116,14 +8160,14 @@ var g = &grammar{
|
|||||||
},
|
},
|
||||||
{
|
{
|
||||||
name: "Integer",
|
name: "Integer",
|
||||||
pos: position{line: 832, col: 1, offset: 31738},
|
pos: position{line: 855, col: 1, offset: 32310},
|
||||||
expr: &actionExpr{
|
expr: &actionExpr{
|
||||||
pos: position{line: 832, col: 12, offset: 31749},
|
pos: position{line: 855, col: 12, offset: 32321},
|
||||||
run: (*parser).callonInteger1,
|
run: (*parser).callonInteger1,
|
||||||
expr: &oneOrMoreExpr{
|
expr: &oneOrMoreExpr{
|
||||||
pos: position{line: 832, col: 12, offset: 31749},
|
pos: position{line: 855, col: 12, offset: 32321},
|
||||||
expr: &charClassMatcher{
|
expr: &charClassMatcher{
|
||||||
pos: position{line: 832, col: 12, offset: 31749},
|
pos: position{line: 855, col: 12, offset: 32321},
|
||||||
val: "[0-9]",
|
val: "[0-9]",
|
||||||
ranges: []rune{'0', '9'},
|
ranges: []rune{'0', '9'},
|
||||||
ignoreCase: false,
|
ignoreCase: false,
|
||||||
@@ -8134,29 +8178,29 @@ var g = &grammar{
|
|||||||
},
|
},
|
||||||
{
|
{
|
||||||
name: "StringCharacter",
|
name: "StringCharacter",
|
||||||
pos: position{line: 836, col: 1, offset: 31801},
|
pos: position{line: 859, col: 1, offset: 32373},
|
||||||
expr: &choiceExpr{
|
expr: &choiceExpr{
|
||||||
pos: position{line: 836, col: 20, offset: 31820},
|
pos: position{line: 859, col: 20, offset: 32392},
|
||||||
alternatives: []any{
|
alternatives: []any{
|
||||||
&actionExpr{
|
&actionExpr{
|
||||||
pos: position{line: 836, col: 20, offset: 31820},
|
pos: position{line: 859, col: 20, offset: 32392},
|
||||||
run: (*parser).callonStringCharacter2,
|
run: (*parser).callonStringCharacter2,
|
||||||
expr: &seqExpr{
|
expr: &seqExpr{
|
||||||
pos: position{line: 836, col: 20, offset: 31820},
|
pos: position{line: 859, col: 20, offset: 32392},
|
||||||
exprs: []any{
|
exprs: []any{
|
||||||
¬Expr{
|
¬Expr{
|
||||||
pos: position{line: 836, col: 20, offset: 31820},
|
pos: position{line: 859, col: 20, offset: 32392},
|
||||||
expr: &choiceExpr{
|
expr: &choiceExpr{
|
||||||
pos: position{line: 836, col: 22, offset: 31822},
|
pos: position{line: 859, col: 22, offset: 32394},
|
||||||
alternatives: []any{
|
alternatives: []any{
|
||||||
&litMatcher{
|
&litMatcher{
|
||||||
pos: position{line: 836, col: 22, offset: 31822},
|
pos: position{line: 859, col: 22, offset: 32394},
|
||||||
val: "\"",
|
val: "\"",
|
||||||
ignoreCase: false,
|
ignoreCase: false,
|
||||||
want: "\"\\\"\"",
|
want: "\"\\\"\"",
|
||||||
},
|
},
|
||||||
&litMatcher{
|
&litMatcher{
|
||||||
pos: position{line: 836, col: 28, offset: 31828},
|
pos: position{line: 859, col: 28, offset: 32400},
|
||||||
val: "\\",
|
val: "\\",
|
||||||
ignoreCase: false,
|
ignoreCase: false,
|
||||||
want: "\"\\\\\"",
|
want: "\"\\\\\"",
|
||||||
@@ -8165,28 +8209,28 @@ var g = &grammar{
|
|||||||
},
|
},
|
||||||
},
|
},
|
||||||
&anyMatcher{
|
&anyMatcher{
|
||||||
line: 836, col: 34, offset: 31834,
|
line: 859, col: 34, offset: 32406,
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
&actionExpr{
|
&actionExpr{
|
||||||
pos: position{line: 837, col: 5, offset: 31871},
|
pos: position{line: 860, col: 5, offset: 32443},
|
||||||
run: (*parser).callonStringCharacter9,
|
run: (*parser).callonStringCharacter9,
|
||||||
expr: &seqExpr{
|
expr: &seqExpr{
|
||||||
pos: position{line: 837, col: 5, offset: 31871},
|
pos: position{line: 860, col: 5, offset: 32443},
|
||||||
exprs: []any{
|
exprs: []any{
|
||||||
&litMatcher{
|
&litMatcher{
|
||||||
pos: position{line: 837, col: 5, offset: 31871},
|
pos: position{line: 860, col: 5, offset: 32443},
|
||||||
val: "\\",
|
val: "\\",
|
||||||
ignoreCase: false,
|
ignoreCase: false,
|
||||||
want: "\"\\\\\"",
|
want: "\"\\\\\"",
|
||||||
},
|
},
|
||||||
&labeledExpr{
|
&labeledExpr{
|
||||||
pos: position{line: 837, col: 10, offset: 31876},
|
pos: position{line: 860, col: 10, offset: 32448},
|
||||||
label: "seq",
|
label: "seq",
|
||||||
expr: &ruleRefExpr{
|
expr: &ruleRefExpr{
|
||||||
pos: position{line: 837, col: 14, offset: 31880},
|
pos: position{line: 860, col: 14, offset: 32452},
|
||||||
name: "EscapeSequenceCharacter",
|
name: "EscapeSequenceCharacter",
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
@@ -8198,85 +8242,85 @@ var g = &grammar{
|
|||||||
},
|
},
|
||||||
{
|
{
|
||||||
name: "EscapeSequenceCharacter",
|
name: "EscapeSequenceCharacter",
|
||||||
pos: position{line: 839, col: 1, offset: 31925},
|
pos: position{line: 862, col: 1, offset: 32497},
|
||||||
expr: &labeledExpr{
|
expr: &labeledExpr{
|
||||||
pos: position{line: 839, col: 28, offset: 31952},
|
pos: position{line: 862, col: 28, offset: 32524},
|
||||||
label: "char",
|
label: "char",
|
||||||
expr: &ruleRefExpr{
|
expr: &ruleRefExpr{
|
||||||
pos: position{line: 839, col: 33, offset: 31957},
|
pos: position{line: 862, col: 33, offset: 32529},
|
||||||
name: "EscapeCharacter",
|
name: "EscapeCharacter",
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
name: "EscapeCharacter",
|
name: "EscapeCharacter",
|
||||||
pos: position{line: 841, col: 1, offset: 31974},
|
pos: position{line: 864, col: 1, offset: 32546},
|
||||||
expr: &choiceExpr{
|
expr: &choiceExpr{
|
||||||
pos: position{line: 841, col: 20, offset: 31993},
|
pos: position{line: 864, col: 20, offset: 32565},
|
||||||
alternatives: []any{
|
alternatives: []any{
|
||||||
&litMatcher{
|
&litMatcher{
|
||||||
pos: position{line: 841, col: 20, offset: 31993},
|
pos: position{line: 864, col: 20, offset: 32565},
|
||||||
val: "'",
|
val: "'",
|
||||||
ignoreCase: false,
|
ignoreCase: false,
|
||||||
want: "\"'\"",
|
want: "\"'\"",
|
||||||
},
|
},
|
||||||
&litMatcher{
|
&litMatcher{
|
||||||
pos: position{line: 842, col: 5, offset: 32001},
|
pos: position{line: 865, col: 5, offset: 32573},
|
||||||
val: "\"",
|
val: "\"",
|
||||||
ignoreCase: false,
|
ignoreCase: false,
|
||||||
want: "\"\\\"\"",
|
want: "\"\\\"\"",
|
||||||
},
|
},
|
||||||
&litMatcher{
|
&litMatcher{
|
||||||
pos: position{line: 843, col: 5, offset: 32009},
|
pos: position{line: 866, col: 5, offset: 32581},
|
||||||
val: "\\",
|
val: "\\",
|
||||||
ignoreCase: false,
|
ignoreCase: false,
|
||||||
want: "\"\\\\\"",
|
want: "\"\\\\\"",
|
||||||
},
|
},
|
||||||
&actionExpr{
|
&actionExpr{
|
||||||
pos: position{line: 844, col: 5, offset: 32018},
|
pos: position{line: 867, col: 5, offset: 32590},
|
||||||
run: (*parser).callonEscapeCharacter5,
|
run: (*parser).callonEscapeCharacter5,
|
||||||
expr: &litMatcher{
|
expr: &litMatcher{
|
||||||
pos: position{line: 844, col: 5, offset: 32018},
|
pos: position{line: 867, col: 5, offset: 32590},
|
||||||
val: "b",
|
val: "b",
|
||||||
ignoreCase: false,
|
ignoreCase: false,
|
||||||
want: "\"b\"",
|
want: "\"b\"",
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
&actionExpr{
|
&actionExpr{
|
||||||
pos: position{line: 845, col: 5, offset: 32047},
|
pos: position{line: 868, col: 5, offset: 32619},
|
||||||
run: (*parser).callonEscapeCharacter7,
|
run: (*parser).callonEscapeCharacter7,
|
||||||
expr: &litMatcher{
|
expr: &litMatcher{
|
||||||
pos: position{line: 845, col: 5, offset: 32047},
|
pos: position{line: 868, col: 5, offset: 32619},
|
||||||
val: "f",
|
val: "f",
|
||||||
ignoreCase: false,
|
ignoreCase: false,
|
||||||
want: "\"f\"",
|
want: "\"f\"",
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
&actionExpr{
|
&actionExpr{
|
||||||
pos: position{line: 846, col: 5, offset: 32076},
|
pos: position{line: 869, col: 5, offset: 32648},
|
||||||
run: (*parser).callonEscapeCharacter9,
|
run: (*parser).callonEscapeCharacter9,
|
||||||
expr: &litMatcher{
|
expr: &litMatcher{
|
||||||
pos: position{line: 846, col: 5, offset: 32076},
|
pos: position{line: 869, col: 5, offset: 32648},
|
||||||
val: "n",
|
val: "n",
|
||||||
ignoreCase: false,
|
ignoreCase: false,
|
||||||
want: "\"n\"",
|
want: "\"n\"",
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
&actionExpr{
|
&actionExpr{
|
||||||
pos: position{line: 847, col: 5, offset: 32105},
|
pos: position{line: 870, col: 5, offset: 32677},
|
||||||
run: (*parser).callonEscapeCharacter11,
|
run: (*parser).callonEscapeCharacter11,
|
||||||
expr: &litMatcher{
|
expr: &litMatcher{
|
||||||
pos: position{line: 847, col: 5, offset: 32105},
|
pos: position{line: 870, col: 5, offset: 32677},
|
||||||
val: "r",
|
val: "r",
|
||||||
ignoreCase: false,
|
ignoreCase: false,
|
||||||
want: "\"r\"",
|
want: "\"r\"",
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
&actionExpr{
|
&actionExpr{
|
||||||
pos: position{line: 848, col: 5, offset: 32134},
|
pos: position{line: 871, col: 5, offset: 32706},
|
||||||
run: (*parser).callonEscapeCharacter13,
|
run: (*parser).callonEscapeCharacter13,
|
||||||
expr: &litMatcher{
|
expr: &litMatcher{
|
||||||
pos: position{line: 848, col: 5, offset: 32134},
|
pos: position{line: 871, col: 5, offset: 32706},
|
||||||
val: "t",
|
val: "t",
|
||||||
ignoreCase: false,
|
ignoreCase: false,
|
||||||
want: "\"t\"",
|
want: "\"t\"",
|
||||||
@@ -8287,25 +8331,25 @@ var g = &grammar{
|
|||||||
},
|
},
|
||||||
{
|
{
|
||||||
name: "non_escape_character",
|
name: "non_escape_character",
|
||||||
pos: position{line: 850, col: 1, offset: 32160},
|
pos: position{line: 873, col: 1, offset: 32732},
|
||||||
expr: &actionExpr{
|
expr: &actionExpr{
|
||||||
pos: position{line: 850, col: 25, offset: 32184},
|
pos: position{line: 873, col: 25, offset: 32756},
|
||||||
run: (*parser).callonnon_escape_character1,
|
run: (*parser).callonnon_escape_character1,
|
||||||
expr: &seqExpr{
|
expr: &seqExpr{
|
||||||
pos: position{line: 850, col: 25, offset: 32184},
|
pos: position{line: 873, col: 25, offset: 32756},
|
||||||
exprs: []any{
|
exprs: []any{
|
||||||
¬Expr{
|
¬Expr{
|
||||||
pos: position{line: 850, col: 25, offset: 32184},
|
pos: position{line: 873, col: 25, offset: 32756},
|
||||||
expr: &ruleRefExpr{
|
expr: &ruleRefExpr{
|
||||||
pos: position{line: 850, col: 27, offset: 32186},
|
pos: position{line: 873, col: 27, offset: 32758},
|
||||||
name: "escape_character",
|
name: "escape_character",
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
&labeledExpr{
|
&labeledExpr{
|
||||||
pos: position{line: 850, col: 45, offset: 32204},
|
pos: position{line: 873, col: 45, offset: 32776},
|
||||||
label: "char",
|
label: "char",
|
||||||
expr: &anyMatcher{
|
expr: &anyMatcher{
|
||||||
line: 850, col: 50, offset: 32209,
|
line: 873, col: 50, offset: 32781,
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
@@ -8314,11 +8358,11 @@ var g = &grammar{
|
|||||||
},
|
},
|
||||||
{
|
{
|
||||||
name: "ws",
|
name: "ws",
|
||||||
pos: position{line: 853, col: 1, offset: 32248},
|
pos: position{line: 876, col: 1, offset: 32820},
|
||||||
expr: &zeroOrMoreExpr{
|
expr: &zeroOrMoreExpr{
|
||||||
pos: position{line: 853, col: 7, offset: 32254},
|
pos: position{line: 876, col: 7, offset: 32826},
|
||||||
expr: &charClassMatcher{
|
expr: &charClassMatcher{
|
||||||
pos: position{line: 853, col: 7, offset: 32254},
|
pos: position{line: 876, col: 7, offset: 32826},
|
||||||
val: "[ \\t\\n\\r]",
|
val: "[ \\t\\n\\r]",
|
||||||
chars: []rune{' ', '\t', '\n', '\r'},
|
chars: []rune{' ', '\t', '\n', '\r'},
|
||||||
ignoreCase: false,
|
ignoreCase: false,
|
||||||
@@ -8328,11 +8372,11 @@ var g = &grammar{
|
|||||||
},
|
},
|
||||||
{
|
{
|
||||||
name: "wss",
|
name: "wss",
|
||||||
pos: position{line: 855, col: 1, offset: 32266},
|
pos: position{line: 878, col: 1, offset: 32838},
|
||||||
expr: &oneOrMoreExpr{
|
expr: &oneOrMoreExpr{
|
||||||
pos: position{line: 855, col: 8, offset: 32273},
|
pos: position{line: 878, col: 8, offset: 32845},
|
||||||
expr: &charClassMatcher{
|
expr: &charClassMatcher{
|
||||||
pos: position{line: 855, col: 8, offset: 32273},
|
pos: position{line: 878, col: 8, offset: 32845},
|
||||||
val: "[ \\t\\n\\r]",
|
val: "[ \\t\\n\\r]",
|
||||||
chars: []rune{' ', '\t', '\n', '\r'},
|
chars: []rune{' ', '\t', '\n', '\r'},
|
||||||
ignoreCase: false,
|
ignoreCase: false,
|
||||||
@@ -8342,11 +8386,11 @@ var g = &grammar{
|
|||||||
},
|
},
|
||||||
{
|
{
|
||||||
name: "EOF",
|
name: "EOF",
|
||||||
pos: position{line: 857, col: 1, offset: 32285},
|
pos: position{line: 880, col: 1, offset: 32857},
|
||||||
expr: ¬Expr{
|
expr: ¬Expr{
|
||||||
pos: position{line: 857, col: 8, offset: 32292},
|
pos: position{line: 880, col: 8, offset: 32864},
|
||||||
expr: &anyMatcher{
|
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()
|
return p.cur.onMathRandExpression1()
|
||||||
}
|
}
|
||||||
|
|
||||||
func (c *current) onInFunction15(ex any) (any, error) {
|
func (c *current) onInFunction20(ex any) (any, error) {
|
||||||
return ex, nil
|
return ex, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
func (p *parser) callonInFunction15() (any, error) {
|
func (p *parser) callonInFunction20() (any, error) {
|
||||||
stack := p.vstack[len(p.vstack)-1]
|
stack := p.vstack[len(p.vstack)-1]
|
||||||
_ = stack
|
_ = stack
|
||||||
return p.cur.onInFunction15(stack["ex"])
|
return p.cur.onInFunction20(stack["ex"])
|
||||||
}
|
}
|
||||||
|
|
||||||
func (c *current) onInFunction2(ex1, ex2, others any) (any, error) {
|
func (c *current) onInFunction2(ex1, notIn, ex2, others any) (any, error) {
|
||||||
return createFunctionCall(parsers.FunctionCallIn, append([]interface{}{ex1, ex2}, others.([]interface{})...))
|
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) {
|
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.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
|
return ex, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
func (p *parser) callonInFunction39() (any, error) {
|
func (p *parser) callonInFunction49() (any, error) {
|
||||||
stack := p.vstack[len(p.vstack)-1]
|
stack := p.vstack[len(p.vstack)-1]
|
||||||
_ = stack
|
_ = stack
|
||||||
return p.cur.onInFunction39(stack["ex"])
|
return p.cur.onInFunction49(stack["ex"])
|
||||||
}
|
}
|
||||||
|
|
||||||
func (c *current) onInFunction24(ex1, ex2, others any) (any, error) {
|
func (c *current) onInFunction29(ex1, notIn, ex2, others any) (any, error) {
|
||||||
return createFunctionCall(parsers.FunctionCallIn, append([]interface{}{ex1, ex2}, others.([]interface{})...))
|
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 := p.vstack[len(p.vstack)-1]
|
||||||
_ = stack
|
_ = 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) {
|
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{}{}) }
|
MathPiExpression <- "PI"i ws "(" ws ")" { return createFunctionCall(parsers.FunctionCallMathPi, []interface{}{}) }
|
||||||
MathRandExpression <- "RAND"i ws "(" ws ")" { return createFunctionCall(parsers.FunctionCallMathRand, []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 ")" {
|
InFunction <- ex1:SelectProperty ws notIn:("NOT"i 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{})...))
|
arguments := 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 ")" {
|
functionCall, _ := createFunctionCall(parsers.FunctionCallIn, arguments)
|
||||||
return createFunctionCall(parsers.FunctionCallIn, append([]interface{}{ex1, ex2}, others.([]interface{})...))
|
|
||||||
|
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 ")" {
|
AvgAggregateExpression <- "AVG"i "(" ws ex:SelectItem ws ")" {
|
||||||
|
|||||||
@@ -5,18 +5,46 @@ import (
|
|||||||
"github.com/pikami/cosmium/parsers"
|
"github.com/pikami/cosmium/parsers"
|
||||||
)
|
)
|
||||||
|
|
||||||
func ExecuteQuery(query parsers.SelectStmt, documents rowTypeIterator) []RowType {
|
type ExecuteQueryResult struct {
|
||||||
|
Rows []RowType
|
||||||
|
HasMorePages bool
|
||||||
|
}
|
||||||
|
|
||||||
|
func ExecuteQuery(
|
||||||
|
query parsers.SelectStmt,
|
||||||
|
documents rowTypeIterator,
|
||||||
|
offset int,
|
||||||
|
limit int,
|
||||||
|
) ExecuteQueryResult {
|
||||||
resultIter := executeQuery(query, &rowTypeToRowContextIterator{documents: documents, query: query})
|
resultIter := executeQuery(query, &rowTypeToRowContextIterator{documents: documents, query: query})
|
||||||
result := make([]RowType, 0)
|
|
||||||
for {
|
result := &ExecuteQueryResult{
|
||||||
|
Rows: make([]RowType, 0),
|
||||||
|
HasMorePages: false,
|
||||||
|
}
|
||||||
|
|
||||||
|
for i := 0; i < offset; i++ {
|
||||||
|
_, status := resultIter.Next()
|
||||||
|
if status != datastore.StatusOk {
|
||||||
|
break
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
for i := 0; i < limit; i++ {
|
||||||
row, status := resultIter.Next()
|
row, status := resultIter.Next()
|
||||||
if status != datastore.StatusOk {
|
if status != datastore.StatusOk {
|
||||||
break
|
break
|
||||||
}
|
}
|
||||||
|
|
||||||
result = append(result, row)
|
result.Rows = append(result.Rows, row)
|
||||||
}
|
}
|
||||||
return result
|
|
||||||
|
_, status := resultIter.Next()
|
||||||
|
if status == datastore.StatusOk {
|
||||||
|
result.HasMorePages = true
|
||||||
|
}
|
||||||
|
|
||||||
|
return *result
|
||||||
}
|
}
|
||||||
|
|
||||||
func executeQuery(query parsers.SelectStmt, documents rowIterator) rowTypeIterator {
|
func executeQuery(query parsers.SelectStmt, documents rowIterator) rowTypeIterator {
|
||||||
|
|||||||
@@ -38,10 +38,10 @@ func testQueryExecute(
|
|||||||
expectedData []memoryexecutor.RowType,
|
expectedData []memoryexecutor.RowType,
|
||||||
) {
|
) {
|
||||||
iter := NewTestDocumentIterator(data)
|
iter := NewTestDocumentIterator(data)
|
||||||
result := memoryexecutor.ExecuteQuery(query, iter)
|
result := memoryexecutor.ExecuteQuery(query, iter, 0, 1000)
|
||||||
|
|
||||||
if !reflect.DeepEqual(result, expectedData) {
|
if !reflect.DeepEqual(result.Rows, expectedData) {
|
||||||
t.Errorf("execution result does not match expected data.\nExpected: %+v\nGot: %+v", expectedData, result)
|
t.Errorf("execution result does not match expected data.\nExpected: %+v\nGot: %+v", expectedData, result.Rows)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -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) {
|
t.Run("Should execute IN function with function call", func(t *testing.T) {
|
||||||
testQueryExecute(
|
testQueryExecute(
|
||||||
t,
|
t,
|
||||||
|
|||||||
@@ -7,6 +7,9 @@ int test_Databases();
|
|||||||
|
|
||||||
int main(int argc, char *argv[])
|
int main(int argc, char *argv[])
|
||||||
{
|
{
|
||||||
|
/* Disable stdout buffering for CI environments without a real terminal */
|
||||||
|
setvbuf(stdout, NULL, _IONBF, 0);
|
||||||
|
|
||||||
if (argc < 2)
|
if (argc < 2)
|
||||||
{
|
{
|
||||||
fprintf(stderr, "Usage: %s <path_to_shared_library>\n", argv[0]);
|
fprintf(stderr, "Usage: %s <path_to_shared_library>\n", argv[0]);
|
||||||
@@ -14,13 +17,20 @@ int main(int argc, char *argv[])
|
|||||||
}
|
}
|
||||||
|
|
||||||
const char *libPath = argv[1];
|
const char *libPath = argv[1];
|
||||||
handle = dlopen(libPath, RTLD_LAZY);
|
handle = load_library(libPath);
|
||||||
if (!handle)
|
if (!handle)
|
||||||
{
|
{
|
||||||
fprintf(stderr, "Failed to load shared library: %s\n", dlerror());
|
fprintf(stderr, "Failed to load shared library: %s\n", get_load_error());
|
||||||
return EXIT_FAILURE;
|
return EXIT_FAILURE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* give the loaded library a short time to initialize */
|
||||||
|
#ifdef _WIN32
|
||||||
|
Sleep(1000);
|
||||||
|
#else
|
||||||
|
sleep(1);
|
||||||
|
#endif
|
||||||
|
|
||||||
printf("Running tests for library: %s\n", libPath);
|
printf("Running tests for library: %s\n", libPath);
|
||||||
int results[] = {
|
int results[] = {
|
||||||
test_CreateServerInstance(),
|
test_CreateServerInstance(),
|
||||||
@@ -41,6 +51,15 @@ int main(int argc, char *argv[])
|
|||||||
|
|
||||||
printf("Tests passed: %d/%d\n", numPassed, numTests);
|
printf("Tests passed: %d/%d\n", numPassed, numTests);
|
||||||
|
|
||||||
dlclose(handle);
|
/* Exit explicitly before unloading the library.
|
||||||
return EXIT_SUCCESS;
|
Go runtime cleanup during FreeLibrary can set a non-zero exit code on Windows. */
|
||||||
|
int exitCode = (numPassed == numTests) ? EXIT_SUCCESS : EXIT_FAILURE;
|
||||||
|
|
||||||
|
#ifdef _WIN32
|
||||||
|
ExitProcess(exitCode);
|
||||||
|
#else
|
||||||
|
close_library(handle);
|
||||||
|
#endif
|
||||||
|
|
||||||
|
return exitCode;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,13 +1,50 @@
|
|||||||
#include "shared.h"
|
#include "shared.h"
|
||||||
|
|
||||||
void *handle = NULL;
|
lib_handle_t handle = NULL;
|
||||||
|
|
||||||
|
char *get_load_error(void)
|
||||||
|
{
|
||||||
|
#ifdef _WIN32
|
||||||
|
DWORD error = GetLastError();
|
||||||
|
static char buf[256];
|
||||||
|
FormatMessageA(FORMAT_MESSAGE_FROM_SYSTEM | FORMAT_MESSAGE_IGNORE_INSERTS,
|
||||||
|
NULL, error, MAKELANGID(LANG_NEUTRAL, SUBLANG_DEFAULT),
|
||||||
|
buf, sizeof(buf), NULL);
|
||||||
|
return buf;
|
||||||
|
#else
|
||||||
|
return dlerror();
|
||||||
|
#endif
|
||||||
|
}
|
||||||
|
|
||||||
|
lib_handle_t load_library(const char *path)
|
||||||
|
{
|
||||||
|
#ifdef _WIN32
|
||||||
|
return LoadLibraryA(path);
|
||||||
|
#else
|
||||||
|
return dlopen(path, RTLD_LAZY);
|
||||||
|
#endif
|
||||||
|
}
|
||||||
|
|
||||||
|
void close_library(lib_handle_t handle)
|
||||||
|
{
|
||||||
|
#ifdef _WIN32
|
||||||
|
FreeLibrary(handle);
|
||||||
|
#else
|
||||||
|
dlclose(handle);
|
||||||
|
#endif
|
||||||
|
}
|
||||||
|
|
||||||
void *load_function(const char *func_name)
|
void *load_function(const char *func_name)
|
||||||
{
|
{
|
||||||
|
#ifdef _WIN32
|
||||||
|
void *func = (void *)GetProcAddress(handle, func_name);
|
||||||
|
#else
|
||||||
void *func = dlsym(handle, func_name);
|
void *func = dlsym(handle, func_name);
|
||||||
|
#endif
|
||||||
|
|
||||||
if (!func)
|
if (!func)
|
||||||
{
|
{
|
||||||
fprintf(stderr, "Failed to load function %s: %s\n", func_name, dlerror());
|
fprintf(stderr, "Failed to load function %s: %s\n", func_name, get_load_error());
|
||||||
}
|
}
|
||||||
return func;
|
return func;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -3,13 +3,24 @@
|
|||||||
|
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
#include <dlfcn.h>
|
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
#include <ctype.h>
|
#include <ctype.h>
|
||||||
|
|
||||||
extern void *handle;
|
#ifdef _WIN32
|
||||||
|
#include <unistd.h>
|
||||||
|
#include <windows.h>
|
||||||
|
typedef HMODULE lib_handle_t;
|
||||||
|
#else
|
||||||
|
#include <dlfcn.h>
|
||||||
|
typedef void* lib_handle_t;
|
||||||
|
#endif
|
||||||
|
|
||||||
|
extern lib_handle_t handle;
|
||||||
|
|
||||||
void *load_function(const char *func_name);
|
void *load_function(const char *func_name);
|
||||||
char *compact_json(const char *json);
|
char *compact_json(const char *json);
|
||||||
|
char *get_load_error(void);
|
||||||
|
lib_handle_t load_library(const char *path);
|
||||||
|
void close_library(lib_handle_t handle);
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|||||||
@@ -2,6 +2,16 @@
|
|||||||
|
|
||||||
int test_Databases()
|
int test_Databases()
|
||||||
{
|
{
|
||||||
|
/* Load FreeMemory function - must use this to free memory allocated by the DLL
|
||||||
|
because the DLL may use a different C runtime heap than the test loader */
|
||||||
|
typedef void (*FreeMemoryFn)(char *);
|
||||||
|
FreeMemoryFn FreeMemory = (FreeMemoryFn)load_function("FreeMemory");
|
||||||
|
if (!FreeMemory)
|
||||||
|
{
|
||||||
|
fprintf(stderr, "Failed to find FreeMemory function\n");
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
typedef int (*CreateDatabaseFn)(char *, char *);
|
typedef int (*CreateDatabaseFn)(char *, char *);
|
||||||
CreateDatabaseFn CreateDatabase = (CreateDatabaseFn)load_function("CreateDatabase");
|
CreateDatabaseFn CreateDatabase = (CreateDatabaseFn)load_function("CreateDatabase");
|
||||||
if (!CreateDatabase)
|
if (!CreateDatabase)
|
||||||
@@ -36,6 +46,7 @@ int test_Databases()
|
|||||||
if (database)
|
if (database)
|
||||||
{
|
{
|
||||||
printf("GetDatabase: SUCCESS (database = %s)\n", database);
|
printf("GetDatabase: SUCCESS (database = %s)\n", database);
|
||||||
|
FreeMemory(database);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -2,6 +2,16 @@
|
|||||||
|
|
||||||
int test_ServerInstanceStateMethods()
|
int test_ServerInstanceStateMethods()
|
||||||
{
|
{
|
||||||
|
/* Load FreeMemory function - must use this to free memory allocated by the DLL
|
||||||
|
because the DLL may use a different C runtime heap than the test loader */
|
||||||
|
typedef void (*FreeMemoryFn)(char *);
|
||||||
|
FreeMemoryFn FreeMemory = (FreeMemoryFn)load_function("FreeMemory");
|
||||||
|
if (!FreeMemory)
|
||||||
|
{
|
||||||
|
fprintf(stderr, "Failed to find FreeMemory function\n");
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
typedef int (*LoadServerInstanceStateFn)(char *, char *);
|
typedef int (*LoadServerInstanceStateFn)(char *, char *);
|
||||||
LoadServerInstanceStateFn LoadServerInstanceState = (LoadServerInstanceStateFn)load_function("LoadServerInstanceState");
|
LoadServerInstanceStateFn LoadServerInstanceState = (LoadServerInstanceStateFn)load_function("LoadServerInstanceState");
|
||||||
if (!LoadServerInstanceState)
|
if (!LoadServerInstanceState)
|
||||||
@@ -46,7 +56,7 @@ int test_ServerInstanceStateMethods()
|
|||||||
char *compact_state = compact_json(state);
|
char *compact_state = compact_json(state);
|
||||||
if (!compact_state)
|
if (!compact_state)
|
||||||
{
|
{
|
||||||
free(state);
|
FreeMemory(state);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -59,10 +69,12 @@ int test_ServerInstanceStateMethods()
|
|||||||
printf("GetServerInstanceState: State does not match expected value.\n");
|
printf("GetServerInstanceState: State does not match expected value.\n");
|
||||||
printf("Expected: %s\n", expected_state);
|
printf("Expected: %s\n", expected_state);
|
||||||
printf("Actual: %s\n", compact_state);
|
printf("Actual: %s\n", compact_state);
|
||||||
|
FreeMemory(state);
|
||||||
|
free(compact_state);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
free(state);
|
FreeMemory(state);
|
||||||
free(compact_state);
|
free(compact_state);
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user