Compare commits

..
3 Commits
Author SHA1 Message Date
Pijus Kamandulis ce9b802597 Update actions 2026-06-11 23:27:00 +03:00
Pijus Kamandulis 70c5b93859 Update dependencies 2026-06-11 23:23:22 +03:00
Pijus Kamandulis 372352e52e Upgrade to go 1.26.3 2026-06-11 23:09:57 +03:00
4 changed files with 1338 additions and 1570 deletions
-28
View File
@@ -134,34 +134,6 @@ func Test_Documents(t *testing.T) {
)
})
t.Run("Should query document with single-quoted string literal", func(t *testing.T) {
testCosmosQuery(t, collectionClient,
`select c.id
FROM c
WHERE c.id='67890'
ORDER BY c.id`,
nil,
[]interface{}{
map[string]interface{}{"id": "67890"},
},
)
})
t.Run("Should query document with escaped single-quoted string literal", func(t *testing.T) {
ts.DataStore.CreateDocument(testDatabaseName, testCollectionName, map[string]interface{}{"id": "apostrophe-doc", "pk": "ap", "name": "it's"})
testCosmosQuery(t, collectionClient,
`select c.id
FROM c
WHERE c.name='it\'s'
ORDER BY c.id`,
nil,
[]interface{}{
map[string]interface{}{"id": "apostrophe-doc"},
},
)
})
t.Run("Should query document with query parameters", func(t *testing.T) {
testCosmosQuery(t, collectionClient,
`select c.id
+1335 -1508
View File
File diff suppressed because it is too large Load Diff
+3 -8
View File
@@ -509,8 +509,6 @@ IntegerLiteral <- number:Integer {
}
StringLiteral <- "\"" chars:StringCharacter* "\"" {
return parsers.Constant{Type: parsers.ConstantTypeString,Value: joinStrings(chars.([]interface{}))}, nil
} / "'" chars:SingleQuotedStringCharacter* "'" {
return parsers.Constant{Type: parsers.ConstantTypeString,Value: joinStrings(chars.([]interface{}))}, nil
}
FloatLiteral <- [0-9]+"."[0-9]+ {
floatValue, _ := strconv.ParseFloat(string(c.text), 64)
@@ -871,14 +869,11 @@ Integer <- [0-9]+ {
StringCharacter <- !('"' / "\\") . { return string(c.text), nil }
/ "\\" seq:EscapeSequenceCharacter { return seq, nil }
SingleQuotedStringCharacter <- !("'" / "\\") . { return string(c.text), nil }
/ "\\" seq:EscapeSequenceCharacter { return seq, nil }
EscapeSequenceCharacter <- char:EscapeCharacter
EscapeCharacter <- "'" { return "'", nil }
/ '"' { return "\"", nil }
/ "\\" { return "\\", nil }
EscapeCharacter <- "'"
/ '"'
/ "\\"
/ "b" { return "\b", nil }
/ "f" { return "\f", nil }
/ "n" { return "\n", nil }
-26
View File
@@ -149,32 +149,6 @@ func Test_Parse_Were(t *testing.T) {
)
})
t.Run("Should correctly parse single-quoted string literals", func(t *testing.T) {
testQueryParse(
t,
`SELECT c.id FROM c WHERE c.id = '12345' AND c.string = 'it\'s'`,
parsers.SelectStmt{
SelectItems: []parsers.SelectItem{{Path: []string{"c", "id"}}},
Table: parsers.Table{SelectItem: testutils.SelectItem_Path("c")},
Filters: parsers.LogicalExpression{
Operation: parsers.LogicalExpressionTypeAnd,
Expressions: []interface{}{
parsers.ComparisonExpression{
Operation: "=",
Left: parsers.SelectItem{Path: []string{"c", "id"}},
Right: testutils.SelectItem_Constant_String("12345"),
},
parsers.ComparisonExpression{
Operation: "=",
Left: parsers.SelectItem{Path: []string{"c", "string"}},
Right: testutils.SelectItem_Constant_String("it's"),
},
},
},
},
)
})
t.Run("Should correctly parse NOT conditions", func(t *testing.T) {
testQueryParse(
t,