Skip to content

Commit e945acf

Browse files
committed
change some APIs and documentation
1 parent 1137c6d commit e945acf

File tree

5 files changed

+145
-79
lines changed

5 files changed

+145
-79
lines changed

Firestore/Swift/Source/ExprImpl.swift

Lines changed: 44 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -92,6 +92,10 @@ public extension Expression {
9292
return BooleanExpression("array_contains_all", [self, Helper.array(values)])
9393
}
9494

95+
func arrayContainsAll(_ arrayExpression: Expression) -> BooleanExpression {
96+
return BooleanExpression("array_contains_all", [self, arrayExpression])
97+
}
98+
9599
func arrayContainsAny(_ values: [Expression]) -> BooleanExpression {
96100
return BooleanExpression("array_contains_any", [self, Helper.array(values)])
97101
}
@@ -100,6 +104,10 @@ public extension Expression {
100104
return BooleanExpression("array_contains_any", [self, Helper.array(values)])
101105
}
102106

107+
func arrayContainsAny(_ arrayExpression: Expression) -> BooleanExpression {
108+
return BooleanExpression("array_contains_any", [self, arrayExpression])
109+
}
110+
103111
func arrayLength() -> FunctionExpression {
104112
return FunctionExpression("array_length", [self])
105113
}
@@ -165,22 +173,30 @@ public extension Expression {
165173
return BooleanExpression("neq", [self, Helper.sendableToExpr(other)])
166174
}
167175

168-
func eqAny(_ others: [Expression]) -> BooleanExpression {
176+
func equalAny(_ others: [Expression]) -> BooleanExpression {
169177
return BooleanExpression("eq_any", [self, Helper.array(others)])
170178
}
171179

172-
func eqAny(_ others: [Sendable]) -> BooleanExpression {
180+
func equalAny(_ others: [Sendable]) -> BooleanExpression {
173181
return BooleanExpression("eq_any", [self, Helper.array(others)])
174182
}
175183

176-
func notEqAny(_ others: [Expression]) -> BooleanExpression {
184+
func equalAny(_ arrayExpression: Expression) -> BooleanExpression {
185+
return BooleanExpression("eq_any", [self, arrayExpression])
186+
}
187+
188+
func notEqualAny(_ others: [Expression]) -> BooleanExpression {
177189
return BooleanExpression("not_eq_any", [self, Helper.array(others)])
178190
}
179191

180-
func notEqAny(_ others: [Sendable]) -> BooleanExpression {
192+
func notEqualAny(_ others: [Sendable]) -> BooleanExpression {
181193
return BooleanExpression("not_eq_any", [self, Helper.array(others)])
182194
}
183195

196+
func notEqualAny(_ arrayExpression: Expression) -> BooleanExpression {
197+
return BooleanExpression("not_eq_any", [self, arrayExpression])
198+
}
199+
184200
// MARK: Checks
185201

186202
// --- Added Type Check Operations ---
@@ -401,52 +417,52 @@ public extension Expression {
401417
return FunctionExpression("vector_length", [self])
402418
}
403419

404-
func cosineDistance(_ other: Expression) -> FunctionExpression {
405-
return FunctionExpression("cosine_distance", [self, other])
420+
func cosineDistance(_ expression: Expression) -> FunctionExpression {
421+
return FunctionExpression("cosine_distance", [self, expression])
406422
}
407423

408-
func cosineDistance(_ other: VectorValue) -> FunctionExpression {
409-
return FunctionExpression("cosine_distance", [self, Helper.sendableToExpr(other)])
424+
func cosineDistance(_ vector: VectorValue) -> FunctionExpression {
425+
return FunctionExpression("cosine_distance", [self, Helper.sendableToExpr(vector)])
410426
}
411427

412-
func cosineDistance(_ other: [Double]) -> FunctionExpression {
413-
return FunctionExpression("cosine_distance", [self, Helper.sendableToExpr(other)])
428+
func cosineDistance(_ vector: [Double]) -> FunctionExpression {
429+
return FunctionExpression("cosine_distance", [self, Helper.sendableToExpr(vector)])
414430
}
415431

416-
func dotProduct(_ other: Expression) -> FunctionExpression {
417-
return FunctionExpression("dot_product", [self, other])
432+
func dotProduct(_ expression: Expression) -> FunctionExpression {
433+
return FunctionExpression("dot_product", [self, expression])
418434
}
419435

420-
func dotProduct(_ other: VectorValue) -> FunctionExpression {
421-
return FunctionExpression("dot_product", [self, Helper.sendableToExpr(other)])
436+
func dotProduct(_ vector: VectorValue) -> FunctionExpression {
437+
return FunctionExpression("dot_product", [self, Helper.sendableToExpr(vector)])
422438
}
423439

424-
func dotProduct(_ other: [Double]) -> FunctionExpression {
425-
return FunctionExpression("dot_product", [self, Helper.sendableToExpr(other)])
440+
func dotProduct(_ vector: [Double]) -> FunctionExpression {
441+
return FunctionExpression("dot_product", [self, Helper.sendableToExpr(vector)])
426442
}
427443

428-
func euclideanDistance(_ other: Expression) -> FunctionExpression {
429-
return FunctionExpression("euclidean_distance", [self, other])
444+
func euclideanDistance(_ expression: Expression) -> FunctionExpression {
445+
return FunctionExpression("euclidean_distance", [self, expression])
430446
}
431447

432-
func euclideanDistance(_ other: VectorValue) -> FunctionExpression {
433-
return FunctionExpression("euclidean_distance", [self, Helper.sendableToExpr(other)])
448+
func euclideanDistance(_ vector: VectorValue) -> FunctionExpression {
449+
return FunctionExpression("euclidean_distance", [self, Helper.sendableToExpr(vector)])
434450
}
435451

436-
func euclideanDistance(_ other: [Double]) -> FunctionExpression {
437-
return FunctionExpression("euclidean_distance", [self, Helper.sendableToExpr(other)])
452+
func euclideanDistance(_ vector: [Double]) -> FunctionExpression {
453+
return FunctionExpression("euclidean_distance", [self, Helper.sendableToExpr(vector)])
438454
}
439455

440-
func manhattanDistance(_ other: Expression) -> FunctionExpression {
441-
return FunctionExpression("manhattan_distance", [self, other])
456+
func manhattanDistance(_ expression: Expression) -> FunctionExpression {
457+
return FunctionExpression("manhattan_distance", [self, expression])
442458
}
443459

444-
func manhattanDistance(_ other: VectorValue) -> FunctionExpression {
445-
return FunctionExpression("manhattan_distance", [self, Helper.sendableToExpr(other)])
460+
func manhattanDistance(_ vector: VectorValue) -> FunctionExpression {
461+
return FunctionExpression("manhattan_distance", [self, Helper.sendableToExpr(vector)])
446462
}
447463

448-
func manhattanDistance(_ other: [Double]) -> FunctionExpression {
449-
return FunctionExpression("manhattan_distance", [self, Helper.sendableToExpr(other)])
464+
func manhattanDistance(_ vector: [Double]) -> FunctionExpression {
465+
return FunctionExpression("manhattan_distance", [self, Helper.sendableToExpr(vector)])
450466
}
451467

452468
// MARK: Timestamp operations

0 commit comments

Comments
 (0)