@@ -88,48 +88,44 @@ fun Query.where(path: FieldPath, equalTo: Any?) = where {
88
88
89
89
@Deprecated(" Deprecated in favor of using a [FilterBuilder]" , replaceWith = ReplaceWith (" where { }" , " dev.gitlive.firebase.firestore" ))
90
90
fun Query.where (field : String , lessThan : Any? = null, greaterThan : Any? = null, arrayContains : Any? = null) = where {
91
- val filters = listOfNotNull(
92
- lessThan?.let { field lessThan it },
93
- greaterThan?.let { field greaterThan it },
94
- arrayContains?.let { field contains it }
91
+ all(
92
+ * listOfNotNull(
93
+ lessThan?.let { field lessThan it },
94
+ greaterThan?.let { field greaterThan it },
95
+ arrayContains?.let { field contains it }
96
+ ).toTypedArray()
95
97
)
96
- filters.fold<Filter , Filter ?>(null ) { acc, filter ->
97
- acc?.let { it and filter } ? : filter
98
- }
99
98
}
100
99
101
100
@Deprecated(" Deprecated in favor of using a [FilterBuilder]" , replaceWith = ReplaceWith (" where { }" , " dev.gitlive.firebase.firestore" ))
102
101
fun Query.where (path : FieldPath , lessThan : Any? = null, greaterThan : Any? = null, arrayContains : Any? = null) = where {
103
- val filters = listOfNotNull(
104
- lessThan?.let { path lessThan it },
105
- greaterThan?.let { path greaterThan it },
106
- arrayContains?.let { path contains it }
102
+ all(
103
+ * listOfNotNull(
104
+ lessThan?.let { path lessThan it },
105
+ greaterThan?.let { path greaterThan it },
106
+ arrayContains?.let { path contains it }
107
+ ).toTypedArray()
107
108
)
108
- filters.fold<Filter , Filter ?>(null ) { acc, filter ->
109
- acc?.let { it and filter } ? : filter
110
- }
111
109
}
112
110
113
111
@Deprecated(" Deprecated in favor of using a [FilterBuilder]" , replaceWith = ReplaceWith (" where { }" , " dev.gitlive.firebase.firestore" ))
114
112
fun Query.where (field : String , inArray : List <Any >? = null, arrayContainsAny : List <Any >? = null) = where {
115
- val filters = listOfNotNull(
116
- inArray?.let { field `in ` it },
117
- arrayContainsAny?.let { field containsAny it },
113
+ all(
114
+ * listOfNotNull(
115
+ inArray?.let { field `in ` it },
116
+ arrayContainsAny?.let { field containsAny it },
117
+ ).toTypedArray()
118
118
)
119
- filters.fold<Filter , Filter ?>(null ) { acc, filter ->
120
- acc?.let { it and filter } ? : filter
121
- }
122
119
}
123
120
124
121
@Deprecated(" Deprecated in favor of using a [FilterBuilder]" , replaceWith = ReplaceWith (" where { }" , " dev.gitlive.firebase.firestore" ))
125
122
fun Query.where (path : FieldPath , inArray : List <Any >? = null, arrayContainsAny : List <Any >? = null) = where {
126
- val filters = listOfNotNull(
127
- inArray?.let { path `in ` it },
128
- arrayContainsAny?.let { path containsAny it },
123
+ all(
124
+ * listOfNotNull(
125
+ inArray?.let { path `in ` it },
126
+ arrayContainsAny?.let { path containsAny it },
127
+ ).toTypedArray()
129
128
)
130
- filters.fold<Filter , Filter ?>(null ) { acc, filter ->
131
- acc?.let { it and filter } ? : filter
132
- }
133
129
}
134
130
135
131
fun Query.orderBy (field : String , direction : Direction = Direction .ASCENDING ) = _orderBy (field, direction)
0 commit comments