Skip to content

Commit 5d41977

Browse files
committed
change some API functions
1 parent 04bca9e commit 5d41977

File tree

12 files changed

+510
-471
lines changed

12 files changed

+510
-471
lines changed

Firestore/Example/Firestore.xcodeproj/project.pbxproj

Lines changed: 10 additions & 8 deletions
Large diffs are not rendered by default.
Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
<?xml version="1.0" encoding="UTF-8"?>
2+
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
3+
<plist version="1.0">
4+
<dict>
5+
<key>API_KEY</key>
6+
<string>AIzaSyAokIfWmVB_re7rNQZjjnzmiWU2Hr5DTUM</string>
7+
<key>GCM_SENDER_ID</key>
8+
<string>323991545240</string>
9+
<key>PLIST_VERSION</key>
10+
<string>1</string>
11+
<key>BUNDLE_ID</key>
12+
<string>iOSTestApp</string>
13+
<key>PROJECT_ID</key>
14+
<string>firestore-sdk-nightly</string>
15+
<key>STORAGE_BUCKET</key>
16+
<string>firestore-sdk-nightly.appspot.com</string>
17+
<key>IS_ADS_ENABLED</key>
18+
<false></false>
19+
<key>IS_ANALYTICS_ENABLED</key>
20+
<false></false>
21+
<key>IS_APPINVITE_ENABLED</key>
22+
<true></true>
23+
<key>IS_GCM_ENABLED</key>
24+
<true></true>
25+
<key>IS_SIGNIN_ENABLED</key>
26+
<true></true>
27+
<key>GOOGLE_APP_ID</key>
28+
<string>1:323991545240:ios:5f550d7ae3ebb43a1cf7ed</string>
29+
</dict>
30+
</plist>

Firestore/Swift/Source/ExprImpl.swift

Lines changed: 92 additions & 92 deletions
Original file line numberDiff line numberDiff line change
@@ -76,28 +76,28 @@ public extension Expression {
7676
return FunctionExpression("array_concat", exprs)
7777
}
7878

79-
func arrayContains(_ element: Expression) -> BooleanExpr {
80-
return BooleanExpr("array_contains", [self, element])
79+
func arrayContains(_ element: Expression) -> BooleanExpression {
80+
return BooleanExpression("array_contains", [self, element])
8181
}
8282

83-
func arrayContains(_ element: Sendable) -> BooleanExpr {
84-
return BooleanExpr("array_contains", [self, Helper.sendableToExpr(element)])
83+
func arrayContains(_ element: Sendable) -> BooleanExpression {
84+
return BooleanExpression("array_contains", [self, Helper.sendableToExpr(element)])
8585
}
8686

87-
func arrayContainsAll(_ values: [Expression]) -> BooleanExpr {
88-
return BooleanExpr("array_contains_all", [self, Helper.array(values)])
87+
func arrayContainsAll(_ values: [Expression]) -> BooleanExpression {
88+
return BooleanExpression("array_contains_all", [self, Helper.array(values)])
8989
}
9090

91-
func arrayContainsAll(_ values: [Sendable]) -> BooleanExpr {
92-
return BooleanExpr("array_contains_all", [self, Helper.array(values)])
91+
func arrayContainsAll(_ values: [Sendable]) -> BooleanExpression {
92+
return BooleanExpression("array_contains_all", [self, Helper.array(values)])
9393
}
9494

95-
func arrayContainsAny(_ values: [Expression]) -> BooleanExpr {
96-
return BooleanExpr("array_contains_any", [self, Helper.array(values)])
95+
func arrayContainsAny(_ values: [Expression]) -> BooleanExpression {
96+
return BooleanExpression("array_contains_any", [self, Helper.array(values)])
9797
}
9898

99-
func arrayContainsAny(_ values: [Sendable]) -> BooleanExpr {
100-
return BooleanExpr("array_contains_any", [self, Helper.array(values)])
99+
func arrayContainsAny(_ values: [Sendable]) -> BooleanExpression {
100+
return BooleanExpression("array_contains_any", [self, Helper.array(values)])
101101
}
102102

103103
func arrayLength() -> FunctionExpression {
@@ -112,113 +112,113 @@ public extension Expression {
112112
return FunctionExpression("array_get", [self, offsetExpr])
113113
}
114114

115-
func gt(_ other: Expression) -> BooleanExpr {
116-
return BooleanExpr("gt", [self, other])
115+
func gt(_ other: Expression) -> BooleanExpression {
116+
return BooleanExpression("gt", [self, other])
117117
}
118118

119-
func gt(_ other: Sendable) -> BooleanExpr {
119+
func gt(_ other: Sendable) -> BooleanExpression {
120120
let exprOther = Helper.sendableToExpr(other)
121-
return BooleanExpr("gt", [self, exprOther])
121+
return BooleanExpression("gt", [self, exprOther])
122122
}
123123

124124
// MARK: - Greater Than or Equal (gte)
125125

126-
func gte(_ other: Expression) -> BooleanExpr {
127-
return BooleanExpr("gte", [self, other])
126+
func gte(_ other: Expression) -> BooleanExpression {
127+
return BooleanExpression("gte", [self, other])
128128
}
129129

130-
func gte(_ other: Sendable) -> BooleanExpr {
130+
func gte(_ other: Sendable) -> BooleanExpression {
131131
let exprOther = Helper.sendableToExpr(other)
132-
return BooleanExpr("gte", [self, exprOther])
132+
return BooleanExpression("gte", [self, exprOther])
133133
}
134134

135135
// MARK: - Less Than (lt)
136136

137-
func lt(_ other: Expression) -> BooleanExpr {
138-
return BooleanExpr("lt", [self, other])
137+
func lt(_ other: Expression) -> BooleanExpression {
138+
return BooleanExpression("lt", [self, other])
139139
}
140140

141-
func lt(_ other: Sendable) -> BooleanExpr {
141+
func lt(_ other: Sendable) -> BooleanExpression {
142142
let exprOther = Helper.sendableToExpr(other)
143-
return BooleanExpr("lt", [self, exprOther])
143+
return BooleanExpression("lt", [self, exprOther])
144144
}
145145

146146
// MARK: - Less Than or Equal (lte)
147147

148-
func lte(_ other: Expression) -> BooleanExpr {
149-
return BooleanExpr("lte", [self, other])
148+
func lte(_ other: Expression) -> BooleanExpression {
149+
return BooleanExpression("lte", [self, other])
150150
}
151151

152-
func lte(_ other: Sendable) -> BooleanExpr {
152+
func lte(_ other: Sendable) -> BooleanExpression {
153153
let exprOther = Helper.sendableToExpr(other)
154-
return BooleanExpr("lte", [self, exprOther])
154+
return BooleanExpression("lte", [self, exprOther])
155155
}
156156

157157
// MARK: - Equal (eq)
158158

159-
func eq(_ other: Expression) -> BooleanExpr {
160-
return BooleanExpr("eq", [self, other])
159+
func eq(_ other: Expression) -> BooleanExpression {
160+
return BooleanExpression("eq", [self, other])
161161
}
162162

163-
func eq(_ other: Sendable) -> BooleanExpr {
163+
func eq(_ other: Sendable) -> BooleanExpression {
164164
let exprOther = Helper.sendableToExpr(other)
165-
return BooleanExpr("eq", [self, exprOther])
165+
return BooleanExpression("eq", [self, exprOther])
166166
}
167167

168-
func neq(_ other: Expression) -> BooleanExpr {
169-
return BooleanExpr("neq", [self, other])
168+
func neq(_ other: Expression) -> BooleanExpression {
169+
return BooleanExpression("neq", [self, other])
170170
}
171171

172-
func neq(_ other: Sendable) -> BooleanExpr {
173-
return BooleanExpr("neq", [self, Helper.sendableToExpr(other)])
172+
func neq(_ other: Sendable) -> BooleanExpression {
173+
return BooleanExpression("neq", [self, Helper.sendableToExpr(other)])
174174
}
175175

176-
func eqAny(_ others: [Expression]) -> BooleanExpr {
177-
return BooleanExpr("eq_any", [self, Helper.array(others)])
176+
func eqAny(_ others: [Expression]) -> BooleanExpression {
177+
return BooleanExpression("eq_any", [self, Helper.array(others)])
178178
}
179179

180-
func eqAny(_ others: [Sendable]) -> BooleanExpr {
181-
return BooleanExpr("eq_any", [self, Helper.array(others)])
180+
func eqAny(_ others: [Sendable]) -> BooleanExpression {
181+
return BooleanExpression("eq_any", [self, Helper.array(others)])
182182
}
183183

184-
func notEqAny(_ others: [Expression]) -> BooleanExpr {
185-
return BooleanExpr("not_eq_any", [self, Helper.array(others)])
184+
func notEqAny(_ others: [Expression]) -> BooleanExpression {
185+
return BooleanExpression("not_eq_any", [self, Helper.array(others)])
186186
}
187187

188-
func notEqAny(_ others: [Sendable]) -> BooleanExpr {
189-
return BooleanExpr("not_eq_any", [self, Helper.array(others)])
188+
func notEqAny(_ others: [Sendable]) -> BooleanExpression {
189+
return BooleanExpression("not_eq_any", [self, Helper.array(others)])
190190
}
191191

192192
// MARK: Checks
193193

194194
// --- Added Type Check Operations ---
195195

196-
func isNan() -> BooleanExpr {
197-
return BooleanExpr("is_nan", [self])
196+
func isNan() -> BooleanExpression {
197+
return BooleanExpression("is_nan", [self])
198198
}
199199

200-
func isNil() -> BooleanExpr {
201-
return BooleanExpr("is_null", [self])
200+
func isNil() -> BooleanExpression {
201+
return BooleanExpression("is_null", [self])
202202
}
203203

204-
func exists() -> BooleanExpr {
205-
return BooleanExpr("exists", [self])
204+
func exists() -> BooleanExpression {
205+
return BooleanExpression("exists", [self])
206206
}
207207

208-
func isError() -> BooleanExpr {
209-
return BooleanExpr("is_error", [self])
208+
func isError() -> BooleanExpression {
209+
return BooleanExpression("is_error", [self])
210210
}
211211

212-
func isAbsent() -> BooleanExpr {
213-
return BooleanExpr("is_absent", [self])
212+
func isAbsent() -> BooleanExpression {
213+
return BooleanExpression("is_absent", [self])
214214
}
215215

216-
func isNotNil() -> BooleanExpr {
217-
return BooleanExpr("is_not_null", [self])
216+
func isNotNil() -> BooleanExpression {
217+
return BooleanExpression("is_not_null", [self])
218218
}
219219

220-
func isNotNan() -> BooleanExpr {
221-
return BooleanExpr("is_not_nan", [self])
220+
func isNotNan() -> BooleanExpression {
221+
return BooleanExpression("is_not_nan", [self])
222222
}
223223

224224
// --- Added String Operations ---
@@ -227,52 +227,52 @@ public extension Expression {
227227
return FunctionExpression("char_length", [self])
228228
}
229229

230-
func like(_ pattern: String) -> BooleanExpr {
231-
return BooleanExpr("like", [self, Helper.sendableToExpr(pattern)])
230+
func like(_ pattern: String) -> BooleanExpression {
231+
return BooleanExpression("like", [self, Helper.sendableToExpr(pattern)])
232232
}
233233

234-
func like(_ pattern: Expression) -> BooleanExpr {
235-
return BooleanExpr("like", [self, pattern])
234+
func like(_ pattern: Expression) -> BooleanExpression {
235+
return BooleanExpression("like", [self, pattern])
236236
}
237237

238-
func regexContains(_ pattern: String) -> BooleanExpr {
239-
return BooleanExpr("regex_contains", [self, Helper.sendableToExpr(pattern)])
238+
func regexContains(_ pattern: String) -> BooleanExpression {
239+
return BooleanExpression("regex_contains", [self, Helper.sendableToExpr(pattern)])
240240
}
241241

242-
func regexContains(_ pattern: Expression) -> BooleanExpr {
243-
return BooleanExpr("regex_contains", [self, pattern])
242+
func regexContains(_ pattern: Expression) -> BooleanExpression {
243+
return BooleanExpression("regex_contains", [self, pattern])
244244
}
245245

246-
func regexMatch(_ pattern: String) -> BooleanExpr {
247-
return BooleanExpr("regex_match", [self, Helper.sendableToExpr(pattern)])
246+
func regexMatch(_ pattern: String) -> BooleanExpression {
247+
return BooleanExpression("regex_match", [self, Helper.sendableToExpr(pattern)])
248248
}
249249

250-
func regexMatch(_ pattern: Expression) -> BooleanExpr {
251-
return BooleanExpr("regex_match", [self, pattern])
250+
func regexMatch(_ pattern: Expression) -> BooleanExpression {
251+
return BooleanExpression("regex_match", [self, pattern])
252252
}
253253

254-
func strContains(_ substring: String) -> BooleanExpr {
255-
return BooleanExpr("str_contains", [self, Helper.sendableToExpr(substring)])
254+
func strContains(_ substring: String) -> BooleanExpression {
255+
return BooleanExpression("str_contains", [self, Helper.sendableToExpr(substring)])
256256
}
257257

258-
func strContains(_ expr: Expression) -> BooleanExpr {
259-
return BooleanExpr("str_contains", [self, expr])
258+
func strContains(_ expr: Expression) -> BooleanExpression {
259+
return BooleanExpression("str_contains", [self, expr])
260260
}
261261

262-
func startsWith(_ prefix: String) -> BooleanExpr {
263-
return BooleanExpr("starts_with", [self, Helper.sendableToExpr(prefix)])
262+
func startsWith(_ prefix: String) -> BooleanExpression {
263+
return BooleanExpression("starts_with", [self, Helper.sendableToExpr(prefix)])
264264
}
265265

266-
func startsWith(_ prefix: Expression) -> BooleanExpr {
267-
return BooleanExpr("starts_with", [self, prefix])
266+
func startsWith(_ prefix: Expression) -> BooleanExpression {
267+
return BooleanExpression("starts_with", [self, prefix])
268268
}
269269

270-
func endsWith(_ suffix: String) -> BooleanExpr {
271-
return BooleanExpr("ends_with", [self, Helper.sendableToExpr(suffix)])
270+
func endsWith(_ suffix: String) -> BooleanExpression {
271+
return BooleanExpression("ends_with", [self, Helper.sendableToExpr(suffix)])
272272
}
273273

274-
func endsWith(_ suffix: Expression) -> BooleanExpr {
275-
return BooleanExpr("ends_with", [self, suffix])
274+
func endsWith(_ suffix: Expression) -> BooleanExpression {
275+
return BooleanExpression("ends_with", [self, suffix])
276276
}
277277

278278
func lowercased() -> FunctionExpression {
@@ -300,33 +300,33 @@ public extension Expression {
300300
return FunctionExpression("reverse", [self])
301301
}
302302

303-
func replaceFirst(_ find: String, _ replace: String) -> FunctionExpression {
303+
func replaceFirst(_ find: String, with replace: String) -> FunctionExpression {
304304
return FunctionExpression(
305305
"replace_first",
306306
[self, Helper.sendableToExpr(find), Helper.sendableToExpr(replace)]
307307
)
308308
}
309309

310-
func replaceFirst(_ find: Expression, _ replace: Expression) -> FunctionExpression {
310+
func replaceFirst(_ find: Expression, with replace: Expression) -> FunctionExpression {
311311
return FunctionExpression("replace_first", [self, find, replace])
312312
}
313313

314-
func replaceAll(_ find: String, _ replace: String) -> FunctionExpression {
314+
func replaceAll(_ find: String, with replace: String) -> FunctionExpression {
315315
return FunctionExpression(
316316
"replace_all",
317317
[self, Helper.sendableToExpr(find), Helper.sendableToExpr(replace)]
318318
)
319319
}
320320

321-
func replaceAll(_ find: Expression, _ replace: Expression) -> FunctionExpression {
321+
func replaceAll(_ find: Expression, with replace: Expression) -> FunctionExpression {
322322
return FunctionExpression("replace_all", [self, find, replace])
323323
}
324324

325325
func byteLength() -> FunctionExpression {
326326
return FunctionExpression("byte_length", [self])
327327
}
328328

329-
func substr(_ position: Int, _ length: Int? = nil) -> FunctionExpression {
329+
func substr(position: Int, length: Int? = nil) -> FunctionExpression {
330330
let positionExpr = Helper.sendableToExpr(position)
331331
if let length = length {
332332
return FunctionExpression("substr", [self, positionExpr, Helper.sendableToExpr(length)])
@@ -335,7 +335,7 @@ public extension Expression {
335335
}
336336
}
337337

338-
func substr(_ position: Expression, _ length: Expression? = nil) -> FunctionExpression {
338+
func substr(position: Expression, length: Expression? = nil) -> FunctionExpression {
339339
if let length = length {
340340
return FunctionExpression("substr", [self, position, length])
341341
} else {
@@ -488,22 +488,22 @@ public extension Expression {
488488
return FunctionExpression("timestamp_to_unix_seconds", [self])
489489
}
490490

491-
func timestampAdd(_ unit: Expression, _ amount: Expression) -> FunctionExpression {
491+
func timestampAdd(amount: Expression, unit: Expression) -> FunctionExpression {
492492
return FunctionExpression("timestamp_add", [self, unit, amount])
493493
}
494494

495-
func timestampAdd(_ unit: TimeUnit, _ amount: Int) -> FunctionExpression {
495+
func timestampAdd(_ amount: Int, _ unit: TimeUnit) -> FunctionExpression {
496496
return FunctionExpression(
497497
"timestamp_add",
498498
[self, Helper.sendableToExpr(unit), Helper.sendableToExpr(amount)]
499499
)
500500
}
501501

502-
func timestampSub(_ unit: Expression, _ amount: Expression) -> FunctionExpression {
502+
func timestampSub(amount: Expression, unit: Expression) -> FunctionExpression {
503503
return FunctionExpression("timestamp_sub", [self, unit, amount])
504504
}
505505

506-
func timestampSub(_ unit: TimeUnit, _ amount: Int) -> FunctionExpression {
506+
func timestampSub(_ amount: Int, _ unit: TimeUnit) -> FunctionExpression {
507507
return FunctionExpression(
508508
"timestamp_sub",
509509
[self, Helper.sendableToExpr(unit), Helper.sendableToExpr(amount)]

Firestore/Swift/Source/SwiftAPI/Pipeline/ArrayContains.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212
// See the License for the specific language governing permissions and
1313
// limitations under the License.
1414

15-
public class ArrayContains: BooleanExpr, @unchecked Sendable {
15+
public class ArrayContains: BooleanExpression, @unchecked Sendable {
1616
public init(fieldName: String, values: Sendable...) {
1717
super.init("array_contains", values.map { Helper.sendableToExpr($0) })
1818
}

0 commit comments

Comments
 (0)