Skip to content

Commit 8f31bb9

Browse files
Fix linting errors
- Remove ineffectual assignment in cel2sql.go - Fix unused parameter by renaming to underscore - Replace fmt.Sprintf with string concatenation for better performance - All golangci-lint issues resolved
1 parent 7cb1379 commit 8f31bb9

File tree

2 files changed

+3
-4
lines changed

2 files changed

+3
-4
lines changed

cel2sql.go

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -449,7 +449,6 @@ func (con *converter) visitCallFunc(expr *exprpb.Expr) error {
449449
case argType.GetPrimitive() == exprpb.Type_BYTES:
450450
sqlFun = "LENGTH"
451451
case isListType(argType):
452-
sqlFun = "ARRAY_LENGTH"
453452
// For PostgreSQL, we need to specify the array dimension (1 for 1D arrays)
454453
con.str.WriteString("ARRAY_LENGTH(")
455454
if target != nil {
@@ -870,7 +869,7 @@ func isFieldAccessExpression(expr *exprpb.Expr) bool {
870869
return false
871870
}
872871

873-
func (con *converter) callTimestampFromString(target *exprpb.Expr, args []*exprpb.Expr) error {
872+
func (con *converter) callTimestampFromString(_ *exprpb.Expr, args []*exprpb.Expr) error {
874873
if len(args) == 1 {
875874
// For PostgreSQL, we need to cast the string to a timestamp
876875
con.str.WriteString("CAST(")

pg/provider_testcontainer_test.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -375,7 +375,7 @@ func TestCELToSQL_ComprehensiveIntegration(t *testing.T) {
375375
t.Logf("Complex date CEL: %s", celExpression)
376376
t.Logf("Complex date SQL: %s", sqlCondition)
377377

378-
query := fmt.Sprintf("SELECT COUNT(*) FROM users WHERE %s", sqlCondition)
378+
query := "SELECT COUNT(*) FROM users WHERE " + sqlCondition
379379
var count int
380380
err = pool.QueryRow(ctx, query).Scan(&count)
381381
require.NoError(t, err)
@@ -399,7 +399,7 @@ func TestCELToSQL_ComprehensiveIntegration(t *testing.T) {
399399
t.Logf("Complex array CEL: %s", celExpression)
400400
t.Logf("Complex array SQL: %s", sqlCondition)
401401

402-
query := fmt.Sprintf("SELECT COUNT(*) FROM products WHERE %s", sqlCondition)
402+
query := "SELECT COUNT(*) FROM products WHERE " + sqlCondition
403403
var count int
404404
err = pool.QueryRow(ctx, query).Scan(&count)
405405
require.NoError(t, err)

0 commit comments

Comments
 (0)