@@ -20,11 +20,12 @@ var basicOperatorMap = map[string]string{
20
20
"$regex" : "~*" ,
21
21
}
22
22
23
- // DefaultPlaceholderName is the default placeholder name used in the generated SQL query.
23
+ // defaultPlaceholderName is the default placeholder name used in the generated SQL query.
24
24
// This name should not be used in the database or any JSONB column. It can be changed using
25
25
// the WithPlaceholderName option.
26
- const DefaultPlaceholderName = "__filter_placeholder"
26
+ const defaultPlaceholderName = "__filter_placeholder"
27
27
28
+ // Converter converts MongoDB filter queries to SQL conditions and values. Use [filter.NewConverter] to create a new instance.
28
29
type Converter struct {
29
30
nestedColumn string
30
31
nestedExemptions []string
@@ -38,9 +39,9 @@ type Converter struct {
38
39
once sync.Once
39
40
}
40
41
41
- // NewConverter creates a new Converter with optional nested JSONB field mapping.
42
+ // NewConverter creates a new [ Converter] with optional nested JSONB field mapping.
42
43
//
43
- // Note: When using github.com/lib/pq, the filter.WithArrayDriver should be set to pq.Array.
44
+ // Note: When using https:// github.com/lib/pq, the [ filter.WithArrayDriver] should be set to pq.Array.
44
45
func NewConverter (options ... Option ) * Converter {
45
46
converter := & Converter {
46
47
// don't set defaults, use the once.Do in #Convert()
@@ -63,7 +64,7 @@ func (c *Converter) Convert(query []byte, startAtParameterIndex int) (conditions
63
64
c .emptyCondition = "FALSE"
64
65
}
65
66
if c .placeholderName == "" {
66
- c .placeholderName = DefaultPlaceholderName
67
+ c .placeholderName = defaultPlaceholderName
67
68
}
68
69
})
69
70
0 commit comments