@@ -23,10 +23,10 @@ import com.google.firebase.firestore.Pipeline
23
23
import com.google.firebase.firestore.UserDataReader
24
24
import com.google.firebase.firestore.VectorValue
25
25
import com.google.firebase.firestore.model.DocumentKey
26
+ import com.google.firebase.firestore.model.FieldPath as ModelFieldPath
26
27
import com.google.firebase.firestore.model.FieldPath.CREATE_TIME_PATH
27
28
import com.google.firebase.firestore.model.FieldPath.KEY_PATH
28
29
import com.google.firebase.firestore.model.FieldPath.UPDATE_TIME_PATH
29
- import com.google.firebase.firestore.model.FieldPath as ModelFieldPath
30
30
import com.google.firebase.firestore.model.MutableDocument
31
31
import com.google.firebase.firestore.model.Values
32
32
import com.google.firebase.firestore.model.Values.encodeValue
@@ -1022,8 +1022,7 @@ abstract class Expr internal constructor() {
1022
1022
* @return A new [BooleanExpr] representing the 'IN' comparison.
1023
1023
*/
1024
1024
@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))
1027
1026
1028
1027
/* *
1029
1028
* 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() {
1047
1046
* @return A new [BooleanExpr] representing the 'IN' comparison.
1048
1047
*/
1049
1048
@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))
1052
1050
1053
1051
/* *
1054
1052
* 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() {
2780
2778
* @return A new [BooleanExpr] representing the arrayContainsAll operation.
2781
2779
*/
2782
2780
@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))
2785
2782
2786
2783
/* *
2787
2784
* Creates an expression that checks if [array] contains all elements of [arrayExpression].
@@ -2803,12 +2800,7 @@ abstract class Expr internal constructor() {
2803
2800
*/
2804
2801
@JvmStatic
2805
2802
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))
2812
2804
2813
2805
/* *
2814
2806
* Creates an expression that checks if array field contains all elements of [arrayExpression].
@@ -2830,12 +2822,7 @@ abstract class Expr internal constructor() {
2830
2822
*/
2831
2823
@JvmStatic
2832
2824
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))
2839
2826
2840
2827
/* *
2841
2828
* Creates an expression that checks if [array] contains any elements of [arrayExpression].
@@ -2857,12 +2844,7 @@ abstract class Expr internal constructor() {
2857
2844
*/
2858
2845
@JvmStatic
2859
2846
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))
2866
2848
2867
2849
/* *
2868
2850
* 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
4194
4176
internal fun toProto (): Value =
4195
4177
Value .newBuilder().setFieldReferenceValue(fieldPath.canonicalString()).build()
4196
4178
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
+ }
4205
4190
}
4206
4191
4207
4192
/* *
0 commit comments