@@ -49,10 +49,9 @@ public protocol Expr: Sendable {
49
49
/// Field("subtotal").add(Field("tax"), Field("shipping"))
50
50
/// ```
51
51
///
52
- /// - Parameter second: An `Expr` to add to this expression.
53
- /// - Parameter others: Optional additional `Expr` values to add.
52
+ /// - Parameter value: Expr` values to add.
54
53
/// - Returns: A new `FunctionExpr` representing the addition operation.
55
- func add( _ second : Expr , _ others : Expr ... ) -> FunctionExpr
54
+ func add( _ value : Expr ) -> FunctionExpr
56
55
57
56
/// Creates an expression that adds this expression to one or more literal values.
58
57
/// Assumes `self` and all parameters evaluate to compatible types for addition.
@@ -65,10 +64,40 @@ public protocol Expr: Sendable {
65
64
/// Field("score").add(10, 20, -5)
66
65
/// ```
67
66
///
68
- /// - Parameter second: A `Sendable` literal value to add to this expression.
69
- /// - Parameter others: Optional additional `Sendable` literal values to add.
67
+ /// - Parameter value: Expr` value to add.
70
68
/// - Returns: A new `FunctionExpr` representing the addition operation.
71
- func add( _ second: Sendable , _ others: Sendable ... ) -> FunctionExpr
69
+ func add( _ value: Sendable ) -> FunctionExpr
70
+
71
+ /// Creates an expression that adds this expression to one or more other expressions.
72
+ /// Assumes `self` and all parameters evaluate to compatible types for addition (e.g., numbers, or
73
+ /// string/array concatenation if supported by the specific "add" implementation).
74
+ ///
75
+ /// ```swift
76
+ /// // Add the value of the 'quantity' field and the 'reserve' field.
77
+ /// Field("quantity").add(Field("reserve"))
78
+ ///
79
+ /// // Add multiple numeric fields
80
+ /// Field("subtotal").add(Field("tax"), Field("shipping"))
81
+ /// ```
82
+ ///
83
+ /// - Parameter values: Expr` values to add.
84
+ /// - Returns: A new `FunctionExpr` representing the addition operation.
85
+ func add( _ values: [ Expr ] ) -> FunctionExpr
86
+
87
+ /// Creates an expression that adds this expression to one or more literal values.
88
+ /// Assumes `self` and all parameters evaluate to compatible types for addition.
89
+ ///
90
+ /// ```swift
91
+ /// // Add 5 to the 'count' field
92
+ /// Field("count").add(5)
93
+ ///
94
+ /// // Add multiple literal numbers
95
+ /// Field("score").add(10, 20, -5)
96
+ /// ```
97
+ ///
98
+ /// - Parameter values: Expr` values to add.
99
+ /// - Returns: A new `FunctionExpr` representing the addition operation.
100
+ func add( _ values: [ Sendable ] ) -> FunctionExpr
72
101
73
102
/// Creates an expression that subtracts another expression from this expression.
74
103
/// Assumes `self` and `other` evaluate to numeric types.
@@ -105,10 +134,39 @@ public protocol Expr: Sendable {
105
134
/// Field("rate").multiply(Field("time"), Field("conversionFactor"))
106
135
/// ```
107
136
///
108
- /// - Parameter second: An `Expr` to multiply by.
109
- /// - Parameter others: Optional additional `Expr` values to multiply by.
137
+ /// - Parameter value: `Expr` value to multiply by.
138
+ /// - Returns: A new `FunctionExpr` representing the multiplication operation.
139
+ func multiply( _ value: Expr ) -> FunctionExpr
140
+
141
+ /// Creates an expression that multiplies this expression by one or more literal values.
142
+ /// Assumes `self` evaluates to a numeric type.
143
+ ///
144
+ /// ```swift
145
+ /// // Multiply the 'score' by 1.1
146
+ /// Field("score").multiply(1.1)
147
+ ///
148
+ /// // Multiply 'base' by 2 and then by 3.0
149
+ /// Field("base").multiply(2, 3.0)
150
+ /// ```
151
+ ///
152
+ /// - Parameter value: `Sendable` literal value to multiply by.
153
+ /// - Returns: A new `FunctionExpr` representing the multiplication operation.
154
+ func multiply( _ value: Sendable ) -> FunctionExpr
155
+
156
+ /// Creates an expression that multiplies this expression by one or more other expressions.
157
+ /// Assumes `self` and all parameters evaluate to numeric types.
158
+ ///
159
+ /// ```swift
160
+ /// // Multiply the 'quantity' field by the 'price' field
161
+ /// Field("quantity").multiply(Field("price"))
162
+ ///
163
+ /// // Multiply 'rate' by 'time' and 'conversionFactor' fields
164
+ /// Field("rate").multiply(Field("time"), Field("conversionFactor"))
165
+ /// ```
166
+ ///
167
+ /// - Parameter values: `Expr` values to multiply by.
110
168
/// - Returns: A new `FunctionExpr` representing the multiplication operation.
111
- func multiply( _ second : Expr , _ others : Expr ... ) -> FunctionExpr
169
+ func multiply( _ values : [ Expr ] ) -> FunctionExpr
112
170
113
171
/// Creates an expression that multiplies this expression by one or more literal values.
114
172
/// Assumes `self` evaluates to a numeric type.
@@ -121,10 +179,9 @@ public protocol Expr: Sendable {
121
179
/// Field("base").multiply(2, 3.0)
122
180
/// ```
123
181
///
124
- /// - Parameter second: A `Sendable` literal value to multiply by.
125
- /// - Parameter others: Optional additional `Sendable` literal values to multiply by.
182
+ /// - Parameter values: `Sendable` literal values to multiply by.
126
183
/// - Returns: A new `FunctionExpr` representing the multiplication operation.
127
- func multiply( _ second : Sendable , _ others : Sendable ... ) -> FunctionExpr
184
+ func multiply( _ values : [ Sendable ] ) -> FunctionExpr
128
185
129
186
/// Creates an expression that divides this expression by another expression.
130
187
/// Assumes `self` and `other` evaluate to numeric types.
0 commit comments