Skip to content

Commit eb8d8d6

Browse files
Make basicOperatorMap private (#10)
It's currently only exposed to make it possible to use it in a test. I don't think that's a good reason. It pollutes our API, and it's even weirder that users of the library would be able to modify it.
1 parent 6348ca9 commit eb8d8d6

2 files changed

Lines changed: 2 additions & 15 deletions

File tree

filter/converter.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ import (
99
"strings"
1010
)
1111

12-
var BasicOperatorMap = map[string]string{
12+
var basicOperatorMap = map[string]string{
1313
"$gt": ">",
1414
"$gte": ">=",
1515
"$lt": "<",
@@ -152,7 +152,7 @@ func (c *Converter) convertFilter(filter map[string]any, paramIndex int) (string
152152
values = append(values, v[operator])
153153
default:
154154
value := v[operator]
155-
op, ok := BasicOperatorMap[operator]
155+
op, ok := basicOperatorMap[operator]
156156
if !ok {
157157
return "", nil, fmt.Errorf("unknown operator: %s", operator)
158158
}

integration/postgres_test.go

Lines changed: 0 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -335,19 +335,6 @@ func TestIntegration_BasicOperators(t *testing.T) {
335335
}
336336
})
337337
}
338-
339-
for op := range filter.BasicOperatorMap {
340-
found := false
341-
for _, tt := range tests {
342-
if strings.Contains(tt.input, op) {
343-
found = true
344-
break
345-
}
346-
}
347-
if !found {
348-
t.Fatalf("operator %q is not tested", op)
349-
}
350-
}
351338
}
352339

353340
func TestIntegration_NestedJSONB(t *testing.T) {

0 commit comments

Comments
 (0)