@@ -23,10 +23,10 @@ import com.google.firebase.firestore.Pipeline
2323import com.google.firebase.firestore.UserDataReader
2424import com.google.firebase.firestore.VectorValue
2525import com.google.firebase.firestore.model.DocumentKey
26+ import com.google.firebase.firestore.model.FieldPath as ModelFieldPath
2627import com.google.firebase.firestore.model.FieldPath.CREATE_TIME_PATH
2728import com.google.firebase.firestore.model.FieldPath.KEY_PATH
2829import com.google.firebase.firestore.model.FieldPath.UPDATE_TIME_PATH
29- import com.google.firebase.firestore.model.FieldPath as ModelFieldPath
3030import com.google.firebase.firestore.model.MutableDocument
3131import com.google.firebase.firestore.model.Values
3232import com.google.firebase.firestore.model.Values.encodeValue
@@ -1022,8 +1022,7 @@ abstract class Expr internal constructor() {
10221022 * @return A new [BooleanExpr] representing the 'IN' comparison.
10231023 */
10241024 @JvmStatic
1025- fun eqAny (expression : Expr , values : List <Any >): BooleanExpr =
1026- eqAny(expression, array(values))
1025+ fun eqAny (expression : Expr , values : List <Any >): BooleanExpr = eqAny(expression, array(values))
10271026
10281027 /* *
10291028 * Creates an expression that checks if an [expression], when evaluated, is equal to any of the
@@ -1047,8 +1046,7 @@ abstract class Expr internal constructor() {
10471046 * @return A new [BooleanExpr] representing the 'IN' comparison.
10481047 */
10491048 @JvmStatic
1050- fun eqAny (fieldName : String , values : List <Any >): BooleanExpr =
1051- eqAny(fieldName, array(values))
1049+ fun eqAny (fieldName : String , values : List <Any >): BooleanExpr = eqAny(fieldName, array(values))
10521050
10531051 /* *
10541052 * Creates an expression that checks if a field's value is equal to any of the elements of
@@ -2780,8 +2778,7 @@ abstract class Expr internal constructor() {
27802778 * @return A new [BooleanExpr] representing the arrayContainsAll operation.
27812779 */
27822780 @JvmStatic
2783- fun arrayContainsAll (array : Expr , values : List <Any >) =
2784- arrayContainsAll(array, array(values))
2781+ fun arrayContainsAll (array : Expr , values : List <Any >) = arrayContainsAll(array, array(values))
27852782
27862783 /* *
27872784 * Creates an expression that checks if [array] contains all elements of [arrayExpression].
@@ -2803,12 +2800,7 @@ abstract class Expr internal constructor() {
28032800 */
28042801 @JvmStatic
28052802 fun arrayContainsAll (arrayFieldName : String , values : List <Any >) =
2806- BooleanExpr (
2807- " array_contains_all" ,
2808- evaluateArrayContainsAll,
2809- arrayFieldName,
2810- array(values)
2811- )
2803+ BooleanExpr (" array_contains_all" , evaluateArrayContainsAll, arrayFieldName, array(values))
28122804
28132805 /* *
28142806 * Creates an expression that checks if array field contains all elements of [arrayExpression].
@@ -2830,12 +2822,7 @@ abstract class Expr internal constructor() {
28302822 */
28312823 @JvmStatic
28322824 fun arrayContainsAny (array : Expr , values : List <Any >) =
2833- BooleanExpr (
2834- " array_contains_any" ,
2835- evaluateArrayContainsAny,
2836- array,
2837- array(values)
2838- )
2825+ BooleanExpr (" array_contains_any" , evaluateArrayContainsAny, array, array(values))
28392826
28402827 /* *
28412828 * Creates an expression that checks if [array] contains any elements of [arrayExpression].
@@ -2857,12 +2844,7 @@ abstract class Expr internal constructor() {
28572844 */
28582845 @JvmStatic
28592846 fun arrayContainsAny (arrayFieldName : String , values : List <Any >) =
2860- BooleanExpr (
2861- " array_contains_any" ,
2862- evaluateArrayContainsAny,
2863- arrayFieldName,
2864- array(values)
2865- )
2847+ BooleanExpr (" array_contains_any" , evaluateArrayContainsAny, arrayFieldName, array(values))
28662848
28672849 /* *
28682850 * Creates an expression that checks if array field contains any elements of [arrayExpression].
@@ -4194,14 +4176,17 @@ class Field internal constructor(private val fieldPath: ModelFieldPath) : Select
41944176 internal fun toProto (): Value =
41954177 Value .newBuilder().setFieldReferenceValue(fieldPath.canonicalString()).build()
41964178
4197- override fun evaluateContext (context : EvaluationContext ) = block@{ input: MutableDocument ->
4198- EvaluateResultValue (when (fieldPath) {
4199- KEY_PATH -> encodeValue(DocumentReference .forPath(input.key.path, context.db))
4200- CREATE_TIME_PATH -> encodeValue(input.createTime.timestamp)
4201- UPDATE_TIME_PATH -> encodeValue(input.version.timestamp)
4202- else -> input.getField(fieldPath) ? : return @block EvaluateResultUnset
4203- })
4204- }
4179+ override fun evaluateContext (context : EvaluationContext ) =
4180+ block@{ input: MutableDocument ->
4181+ EvaluateResultValue (
4182+ when (fieldPath) {
4183+ KEY_PATH -> encodeValue(DocumentReference .forPath(input.key.path, context.db))
4184+ CREATE_TIME_PATH -> encodeValue(input.createTime.timestamp)
4185+ UPDATE_TIME_PATH -> encodeValue(input.version.timestamp)
4186+ else -> input.getField(fieldPath) ? : return @block EvaluateResultUnset
4187+ }
4188+ )
4189+ }
42054190}
42064191
42074192/* *
0 commit comments