@@ -829,8 +829,7 @@ abstract class Expr internal constructor() {
829
829
@JvmStatic fun isNan (fieldName : String ): BooleanExpr = BooleanExpr (" is_nan" , fieldName)
830
830
831
831
/* *
832
- * Creates an expression that checks if the results of [expr] is NOT 'NaN' (Not a
833
- * Number).
832
+ * Creates an expression that checks if the results of [expr] is NOT 'NaN' (Not a Number).
834
833
*
835
834
* @param expr The expression to check.
836
835
* @return A new [BooleanExpr] representing the isNotNan operation.
@@ -942,19 +941,48 @@ abstract class Expr internal constructor() {
942
941
*/
943
942
@JvmStatic fun byteLength (fieldName : String ): Expr = FunctionExpr (" byte_length" , fieldName)
944
943
945
- /* * @return A new [Expr] representing the like operation. */
946
- @JvmStatic fun like (expr : Expr , pattern : Expr ): BooleanExpr = BooleanExpr (" like" , expr, pattern)
944
+ /* *
945
+ * Creates an expression that performs a case-sensitive wildcard string comparison.
946
+ *
947
+ * @param stringExpression The expression representing the string to perform the comparison on.
948
+ * @param pattern The pattern to search for. You can use "%" as a wildcard character.
949
+ * @return A new [BooleanExpr] representing the like operation.
950
+ */
951
+ @JvmStatic
952
+ fun like (stringExpression : Expr , pattern : Expr ): BooleanExpr =
953
+ BooleanExpr (" like" , stringExpression, pattern)
947
954
948
- /* * @return A new [Expr] representing the like operation. */
955
+ /* *
956
+ * Creates an expression that performs a case-sensitive wildcard string comparison.
957
+ *
958
+ * @param stringExpression The expression representing the string to perform the comparison on.
959
+ * @param pattern The pattern to search for. You can use "%" as a wildcard character.
960
+ * @return A new [BooleanExpr] representing the like operation.
961
+ */
949
962
@JvmStatic
950
- fun like (expr : Expr , pattern : String ): BooleanExpr = BooleanExpr (" like" , expr, pattern)
963
+ fun like (stringExpression : Expr , pattern : String ): BooleanExpr =
964
+ BooleanExpr (" like" , stringExpression, pattern)
951
965
952
- /* * @return A new [Expr] representing the like operation. */
966
+ /* *
967
+ * Creates an expression that performs a case-sensitive wildcard string comparison against a
968
+ * field.
969
+ *
970
+ * @param fieldName The name of the field containing the string.
971
+ * @param pattern The pattern to search for. You can use "%" as a wildcard character.
972
+ * @return A new [BooleanExpr] representing the like comparison.
973
+ */
953
974
@JvmStatic
954
975
fun like (fieldName : String , pattern : Expr ): BooleanExpr =
955
976
BooleanExpr (" like" , fieldName, pattern)
956
977
957
- /* * @return A new [Expr] representing the like operation. */
978
+ /* *
979
+ * Creates an expression that performs a case-sensitive wildcard string comparison against a
980
+ * field.
981
+ *
982
+ * @param fieldName The name of the field containing the string.
983
+ * @param pattern The pattern to search for. You can use "%" as a wildcard character.
984
+ * @return A new [BooleanExpr] representing the like comparison.
985
+ */
958
986
@JvmStatic
959
987
fun like (fieldName : String , pattern : String ): BooleanExpr =
960
988
BooleanExpr (" like" , fieldName, pattern)
@@ -999,41 +1027,53 @@ abstract class Expr internal constructor() {
999
1027
fun regexMatch (fieldName : String , pattern : String ) =
1000
1028
BooleanExpr (" regex_match" , fieldName, pattern)
1001
1029
1002
- /* * @return A new [Expr] representing the logicalMax operation. */
1003
- @JvmStatic
1004
- fun logicalMax (left : Expr , right : Expr ): Expr = FunctionExpr (" logical_max" , left, right)
1005
-
1006
- /* * @return A new [Expr] representing the logicalMax operation. */
1007
- @JvmStatic
1008
- fun logicalMax (left : Expr , right : Any ): Expr = FunctionExpr (" logical_max" , left, right)
1009
-
1010
- /* * @return A new [Expr] representing the logicalMax operation. */
1011
- @JvmStatic
1012
- fun logicalMax (fieldName : String , other : Expr ): Expr =
1013
- FunctionExpr (" logical_max" , fieldName, other)
1014
-
1015
- /* * @return A new [Expr] representing the logicalMax operation. */
1016
- @JvmStatic
1017
- fun logicalMax (fieldName : String , other : Any ): Expr =
1018
- FunctionExpr (" logical_max" , fieldName, other)
1019
-
1020
- /* * @return A new [Expr] representing the logicalMin operation. */
1030
+ /* *
1031
+ * Creates an expression that returns the largest value between multiple input expressions or
1032
+ * literal values. Based on Firestore's value type ordering.
1033
+ *
1034
+ * @param expr The first operand expression.
1035
+ * @param others Optional additional expressions or literals.
1036
+ * @return A new [Expr] representing the logical maximum operation.
1037
+ */
1021
1038
@JvmStatic
1022
- fun logicalMin (left : Expr , right : Expr ): Expr = FunctionExpr (" logical_min" , left, right)
1039
+ fun logicalMaximum (expr : Expr , vararg others : Any ): Expr =
1040
+ FunctionExpr (" logical_max" , expr, * others)
1023
1041
1024
- /* * @return A new [Expr] representing the logicalMin operation. */
1042
+ /* *
1043
+ * Creates an expression that returns the largest value between multiple input expressions or
1044
+ * literal values. Based on Firestore's value type ordering.
1045
+ *
1046
+ * @param fieldName The first operand field name.
1047
+ * @param others Optional additional expressions or literals.
1048
+ * @return A new [Expr] representing the logical maximum operation.
1049
+ */
1025
1050
@JvmStatic
1026
- fun logicalMin (left : Expr , right : Any ): Expr = FunctionExpr (" logical_min" , left, right)
1051
+ fun logicalMaximum (fieldName : String , vararg others : Any ): Expr =
1052
+ FunctionExpr (" logical_max" , fieldName, * others)
1027
1053
1028
- /* * @return A new [Expr] representing the logicalMin operation. */
1054
+ /* *
1055
+ * Creates an expression that returns the smallest value between multiple input expressions or
1056
+ * literal values. Based on Firestore's value type ordering.
1057
+ *
1058
+ * @param expr The first operand expression.
1059
+ * @param others Optional additional expressions or literals.
1060
+ * @return A new [Expr] representing the logical minimum operation.
1061
+ */
1029
1062
@JvmStatic
1030
- fun logicalMin ( fieldName : String , other : Expr ): Expr =
1031
- FunctionExpr (" logical_min" , fieldName, other )
1063
+ fun logicalMinimum ( expr : Expr , vararg others : Any ): Expr =
1064
+ FunctionExpr (" logical_min" , expr, * others )
1032
1065
1033
- /* * @return A new [Expr] representing the logicalMin operation. */
1066
+ /* *
1067
+ * Creates an expression that returns the smallest value between multiple input expressions or
1068
+ * literal values. Based on Firestore's value type ordering.
1069
+ *
1070
+ * @param fieldName The first operand field name.
1071
+ * @param others Optional additional expressions or literals.
1072
+ * @return A new [Expr] representing the logical minimum operation.
1073
+ */
1034
1074
@JvmStatic
1035
- fun logicalMin (fieldName : String , other : Any ): Expr =
1036
- FunctionExpr (" logical_min" , fieldName, other )
1075
+ fun logicalMinimum (fieldName : String , vararg others : Any ): Expr =
1076
+ FunctionExpr (" logical_min" , fieldName, * others )
1037
1077
1038
1078
/* * @return A new [Expr] representing the reverse operation. */
1039
1079
@JvmStatic fun reverse (expr : Expr ): Expr = FunctionExpr (" reverse" , expr)
@@ -1193,9 +1233,14 @@ abstract class Expr internal constructor() {
1193
1233
1194
1234
internal fun map (elements : Array <out Expr >): Expr = FunctionExpr (" map" , elements)
1195
1235
1196
- /* * @return A new [Expr] representing the map operation. */
1236
+ /* *
1237
+ * Creates an expression that creates a Firestore map value from an input object.
1238
+ *
1239
+ * @param elements The input map to evaluate in the expression.
1240
+ * @return A new [Expr] representing the map function.
1241
+ */
1197
1242
@JvmStatic
1198
- fun map (elements : Map <String , Any >) =
1243
+ fun map (elements : Map <String , Any >): Expr =
1199
1244
map(elements.flatMap { listOf (constant(it.key), toExprOrConstant(it.value)) }.toTypedArray())
1200
1245
1201
1246
/* * @return A new [Expr] representing the mapGet operation. */
@@ -1215,12 +1260,12 @@ abstract class Expr internal constructor() {
1215
1260
/* * @return A new [Expr] representing the mapMerge operation. */
1216
1261
@JvmStatic
1217
1262
fun mapMerge (firstMap : Expr , secondMap : Expr , vararg otherMaps : Expr ): Expr =
1218
- FunctionExpr (" map_merge" , firstMap, secondMap, otherMaps)
1263
+ FunctionExpr (" map_merge" , firstMap, secondMap, * otherMaps)
1219
1264
1220
1265
/* * @return A new [Expr] representing the mapMerge operation. */
1221
1266
@JvmStatic
1222
1267
fun mapMerge (mapField : String , secondMap : Expr , vararg otherMaps : Expr ): Expr =
1223
- FunctionExpr (" map_merge" , mapField, secondMap, otherMaps)
1268
+ FunctionExpr (" map_merge" , mapField, secondMap, * otherMaps)
1224
1269
1225
1270
/* * @return A new [Expr] representing the mapRemove operation. */
1226
1271
@JvmStatic
@@ -2341,6 +2386,14 @@ abstract class Expr internal constructor() {
2341
2386
*/
2342
2387
fun notEqAny (arrayExpression : Expr ): BooleanExpr = Companion .notEqAny(this , arrayExpression)
2343
2388
2389
+ /* *
2390
+ * Creates an expression that returns true if yhe result of this expression is absent. Otherwise,
2391
+ * returns false even if the value is null.
2392
+ *
2393
+ * @return A new [BooleanExpr] representing the isAbsent operation.
2394
+ */
2395
+ fun isAbsent (): BooleanExpr = Companion .isAbsent(this )
2396
+
2344
2397
/* *
2345
2398
* Creates an expression that checks if this expression evaluates to 'NaN' (Not a Number).
2346
2399
*
@@ -2402,48 +2455,76 @@ abstract class Expr internal constructor() {
2402
2455
fun byteLength (): Expr = Companion .byteLength(this )
2403
2456
2404
2457
/* *
2458
+ * Creates an expression that performs a case-sensitive wildcard string comparison.
2459
+ *
2460
+ * @param pattern The pattern to search for. You can use "%" as a wildcard character.
2461
+ * @return A new [BooleanExpr] representing the like operation.
2405
2462
*/
2406
- fun like (pattern : Expr ) = Companion .like(this , pattern)
2463
+ fun like (pattern : Expr ): BooleanExpr = Companion .like(this , pattern)
2407
2464
2408
2465
/* *
2466
+ * Creates an expression that performs a case-sensitive wildcard string comparison.
2467
+ *
2468
+ * @param pattern The pattern to search for. You can use "%" as a wildcard character.
2469
+ * @return A new [BooleanExpr] representing the like operation.
2409
2470
*/
2410
- fun like (pattern : String ) = Companion .like(this , pattern)
2471
+ fun like (pattern : String ): BooleanExpr = Companion .like(this , pattern)
2411
2472
2412
2473
/* *
2413
2474
*/
2414
- fun regexContains (pattern : Expr ) = Companion .regexContains(this , pattern)
2475
+ fun regexContains (pattern : Expr ): BooleanExpr = Companion .regexContains(this , pattern)
2415
2476
2416
2477
/* *
2417
2478
*/
2418
- fun regexContains (pattern : String ) = Companion .regexContains(this , pattern)
2479
+ fun regexContains (pattern : String ): BooleanExpr = Companion .regexContains(this , pattern)
2419
2480
2420
2481
/* *
2421
2482
*/
2422
- fun regexMatch (pattern : Expr ) = Companion .regexMatch(this , pattern)
2483
+ fun regexMatch (pattern : Expr ): BooleanExpr = Companion .regexMatch(this , pattern)
2423
2484
2424
2485
/* *
2425
2486
*/
2426
- fun regexMatch (pattern : String ) = Companion .regexMatch(this , pattern)
2487
+ fun regexMatch (pattern : String ): BooleanExpr = Companion .regexMatch(this , pattern)
2427
2488
2428
2489
/* *
2490
+ * Creates an expression that returns the largest value between multiple input expressions or
2491
+ * literal values. Based on Firestore's value type ordering.
2492
+ *
2493
+ * @param others Expressions or literals.
2494
+ * @return A new [Expr] representing the logical maximum operation.
2429
2495
*/
2430
- fun logicalMax ( other : Expr ) = Companion .logicalMax (this , other )
2496
+ fun logicalMaximum ( vararg others : Expr ): Expr = Companion .logicalMaximum (this , * others )
2431
2497
2432
2498
/* *
2499
+ * Creates an expression that returns the largest value between multiple input expressions or
2500
+ * literal values. Based on Firestore's value type ordering.
2501
+ *
2502
+ * @param others Expressions or literals.
2503
+ * @return A new [Expr] representing the logical maximum operation.
2433
2504
*/
2434
- fun logicalMax ( other : Any ) = Companion .logicalMax (this , other )
2505
+ fun logicalMaximum ( vararg others : Any ): Expr = Companion .logicalMaximum (this , * others )
2435
2506
2436
2507
/* *
2508
+ * Creates an expression that returns the smallest value between multiple input expressions or
2509
+ * literal values. Based on Firestore's value type ordering.
2510
+ *
2511
+ * @param others Expressions or literals.
2512
+ * @return A new [Expr] representing the logical minimum operation.
2437
2513
*/
2438
- fun logicalMin ( other : Expr ) = Companion .logicalMin (this , other )
2514
+ fun logicalMinimum ( vararg others : Expr ): Expr = Companion .logicalMinimum (this , * others )
2439
2515
2440
2516
/* *
2517
+ * Creates an expression that returns the smallest value between multiple input expressions or
2518
+ * literal values. Based on Firestore's value type ordering.
2519
+ *
2520
+ * @param others Expressions or literals.
2521
+ * @return A new [Expr] representing the logical minimum operation.
2441
2522
*/
2442
- fun logicalMin ( other : Any ) = Companion .logicalMin (this , other )
2523
+ fun logicalMinimum ( vararg others : Any ): Expr = Companion .logicalMinimum (this , * others )
2443
2524
2444
2525
/* *
2445
2526
*/
2446
- fun reverse () = Companion .reverse(this )
2527
+ fun reverse (): Expr = Companion .reverse(this )
2447
2528
2448
2529
/* *
2449
2530
*/
0 commit comments