@@ -25,14 +25,12 @@ public extension Expr {
25
25
26
26
// MARK: Arithmetic Operators
27
27
28
- func add( _ second : Expr , _ others : Expr ... ) -> FunctionExpr {
29
- return FunctionExpr ( " add " , [ self , second ] + others )
28
+ func add( _ value : Expr ) -> FunctionExpr {
29
+ return FunctionExpr ( " add " , [ self , value ] )
30
30
}
31
31
32
- func add( _ second: Sendable , _ others: Sendable ... ) -> FunctionExpr {
33
- let exprs = [ self ] + [ Helper . sendableToExpr ( second) ] + others
34
- . map { Helper . sendableToExpr ( $0) }
35
- return FunctionExpr ( " add " , exprs)
32
+ func add( _ value: Sendable ) -> FunctionExpr {
33
+ return FunctionExpr ( " add " , [ self , Helper . sendableToExpr ( value) ] )
36
34
}
37
35
38
36
func subtract( _ other: Expr ) -> FunctionExpr {
@@ -43,14 +41,12 @@ public extension Expr {
43
41
return FunctionExpr ( " subtract " , [ self , Helper . sendableToExpr ( other) ] )
44
42
}
45
43
46
- func multiply( _ second : Expr , _ others : Expr ... ) -> FunctionExpr {
47
- return FunctionExpr ( " multiply " , [ self , second ] + others )
44
+ func multiply( _ value : Expr ) -> FunctionExpr {
45
+ return FunctionExpr ( " multiply " , [ self , value ] )
48
46
}
49
47
50
- func multiply( _ second: Sendable , _ others: Sendable ... ) -> FunctionExpr {
51
- let exprs = [ self ] + [ Helper . sendableToExpr ( second) ] + others
52
- . map { Helper . sendableToExpr ( $0) }
53
- return FunctionExpr ( " multiply " , exprs)
48
+ func multiply( _ value: Sendable ) -> FunctionExpr {
49
+ return FunctionExpr ( " multiply " , [ self , Helper . sendableToExpr ( value) ] )
54
50
}
55
51
56
52
func divide( _ other: Expr ) -> FunctionExpr {
@@ -89,34 +85,32 @@ public extension Expr {
89
85
return BooleanExpr ( " array_contains " , [ self , Helper . sendableToExpr ( element) ] )
90
86
}
91
87
92
- func arrayContainsAll( _ values: Expr ... ) -> BooleanExpr {
93
- return BooleanExpr ( " array_contains_all " , [ self ] + values)
88
+ func arrayContainsAll( _ values: [ Expr ] ) -> BooleanExpr {
89
+ return BooleanExpr ( " array_contains_all " , [ self , Helper . array ( values) ] )
94
90
}
95
91
96
- func arrayContainsAll( _ values: Sendable ... ) -> BooleanExpr {
97
- let exprValues = values. map { Helper . sendableToExpr ( $0) }
98
- return BooleanExpr ( " array_contains_all " , [ self ] + exprValues)
92
+ func arrayContainsAll( _ values: [ Sendable ] ) -> BooleanExpr {
93
+ return BooleanExpr ( " array_contains_all " , [ self , Helper . array ( values) ] )
99
94
}
100
95
101
- func arrayContainsAny( _ values: Expr ... ) -> BooleanExpr {
102
- return BooleanExpr ( " array_contains_any " , [ self ] + values)
96
+ func arrayContainsAny( _ values: [ Expr ] ) -> BooleanExpr {
97
+ return BooleanExpr ( " array_contains_any " , [ self , Helper . array ( values) ] )
103
98
}
104
99
105
- func arrayContainsAny( _ values: Sendable ... ) -> BooleanExpr {
106
- let exprValues = values. map { Helper . sendableToExpr ( $0) }
107
- return BooleanExpr ( " array_contains_any " , [ self ] + exprValues)
100
+ func arrayContainsAny( _ values: [ Sendable ] ) -> BooleanExpr {
101
+ return BooleanExpr ( " array_contains_any " , [ self , Helper . array ( values) ] )
108
102
}
109
103
110
104
func arrayLength( ) -> FunctionExpr {
111
105
return FunctionExpr ( " array_length " , [ self ] )
112
106
}
113
107
114
- func arrayOffset ( _ offset: Int ) -> FunctionExpr {
115
- return FunctionExpr ( " array_offset " , [ self , Helper . sendableToExpr ( offset) ] )
108
+ func arrayGet ( _ offset: Int ) -> FunctionExpr {
109
+ return FunctionExpr ( " array_get " , [ self , Helper . sendableToExpr ( offset) ] )
116
110
}
117
111
118
- func arrayOffset ( _ offsetExpr: Expr ) -> FunctionExpr {
119
- return FunctionExpr ( " array_offset " , [ self , offsetExpr] )
112
+ func arrayGet ( _ offsetExpr: Expr ) -> FunctionExpr {
113
+ return FunctionExpr ( " array_get " , [ self , offsetExpr] )
120
114
}
121
115
122
116
func gt( _ other: Expr ) -> BooleanExpr {
@@ -172,31 +166,28 @@ public extension Expr {
172
166
return BooleanExpr ( " eq " , [ self , exprOther] )
173
167
}
174
168
175
- func neq( _ others : Expr ... ) -> BooleanExpr {
176
- return BooleanExpr ( " neq " , [ self ] + others )
169
+ func neq( _ other : Expr ) -> BooleanExpr {
170
+ return BooleanExpr ( " neq " , [ self , other ] )
177
171
}
178
172
179
- func neq( _ others: Sendable ... ) -> BooleanExpr {
180
- let exprOthers = others. map { Helper . sendableToExpr ( $0) }
181
- return BooleanExpr ( " neq " , [ self ] + exprOthers)
173
+ func neq( _ other: Sendable ) -> BooleanExpr {
174
+ return BooleanExpr ( " neq " , [ self , Helper . sendableToExpr ( other) ] )
182
175
}
183
176
184
- func eqAny( _ others: Expr ... ) -> BooleanExpr {
185
- return BooleanExpr ( " eq_any " , [ self ] + others)
177
+ func eqAny( _ others: [ Expr ] ) -> BooleanExpr {
178
+ return BooleanExpr ( " eq_any " , [ self , Helper . array ( others) ] )
186
179
}
187
180
188
- func eqAny( _ others: Sendable ... ) -> BooleanExpr {
189
- let exprOthers = others. map { Helper . sendableToExpr ( $0) }
190
- return BooleanExpr ( " eq_any " , [ self ] + exprOthers)
181
+ func eqAny( _ others: [ Sendable ] ) -> BooleanExpr {
182
+ return BooleanExpr ( " eq_any " , [ self , Helper . array ( others) ] )
191
183
}
192
184
193
- func notEqAny( _ others: Expr ... ) -> BooleanExpr {
194
- return BooleanExpr ( " not_eq_any " , [ self ] + others)
185
+ func notEqAny( _ others: [ Expr ] ) -> BooleanExpr {
186
+ return BooleanExpr ( " not_eq_any " , [ self , Helper . array ( others) ] )
195
187
}
196
188
197
- func notEqAny( _ others: Sendable ... ) -> BooleanExpr {
198
- let exprOthers = others. map { Helper . sendableToExpr ( $0) }
199
- return BooleanExpr ( " not_eq_any " , [ self ] + exprOthers)
189
+ func notEqAny( _ others: [ Sendable ] ) -> BooleanExpr {
190
+ return BooleanExpr ( " not_eq_any " , [ self , Helper . array ( others) ] )
200
191
}
201
192
202
193
// MARK: Checks
@@ -237,12 +228,12 @@ public extension Expr {
237
228
return FunctionExpr ( " char_length " , [ self ] )
238
229
}
239
230
240
- func like( _ pattern: String ) -> FunctionExpr {
241
- return FunctionExpr ( " like " , [ self , Helper . sendableToExpr ( pattern) ] )
231
+ func like( _ pattern: String ) -> BooleanExpr {
232
+ return BooleanExpr ( " like " , [ self , Helper . sendableToExpr ( pattern) ] )
242
233
}
243
234
244
- func like( _ pattern: Expr ) -> FunctionExpr {
245
- return FunctionExpr ( " like " , [ self , pattern] )
235
+ func like( _ pattern: Expr ) -> BooleanExpr {
236
+ return BooleanExpr ( " like " , [ self , pattern] )
246
237
}
247
238
248
239
func regexContains( _ pattern: String ) -> BooleanExpr {
@@ -414,13 +405,13 @@ public extension Expr {
414
405
}
415
406
416
407
func logicalMinimum( _ second: Expr , _ others: Expr ... ) -> FunctionExpr {
417
- return FunctionExpr ( " logical_min " , [ self , second] + others)
408
+ return FunctionExpr ( " logical_minimum " , [ self , second] + others)
418
409
}
419
410
420
411
func logicalMinimum( _ second: Sendable , _ others: Sendable ... ) -> FunctionExpr {
421
412
let exprs = [ self ] + [ Helper . sendableToExpr ( second) ] + others
422
413
. map { Helper . sendableToExpr ( $0) }
423
- return FunctionExpr ( " logical_min " , exprs)
414
+ return FunctionExpr ( " logical_minimum " , exprs)
424
415
}
425
416
426
417
// MARK: Vector Operations
0 commit comments