@@ -88,48 +88,44 @@ fun Query.where(path: FieldPath, equalTo: Any?) = where {
8888
8989@Deprecated(" Deprecated in favor of using a [FilterBuilder]" , replaceWith = ReplaceWith (" where { }" , " dev.gitlive.firebase.firestore" ))
9090fun 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()
9597 )
96- filters.fold<Filter , Filter ?>(null ) { acc, filter ->
97- acc?.let { it and filter } ? : filter
98- }
9998}
10099
101100@Deprecated(" Deprecated in favor of using a [FilterBuilder]" , replaceWith = ReplaceWith (" where { }" , " dev.gitlive.firebase.firestore" ))
102101fun 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()
107108 )
108- filters.fold<Filter , Filter ?>(null ) { acc, filter ->
109- acc?.let { it and filter } ? : filter
110- }
111109}
112110
113111@Deprecated(" Deprecated in favor of using a [FilterBuilder]" , replaceWith = ReplaceWith (" where { }" , " dev.gitlive.firebase.firestore" ))
114112fun 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()
118118 )
119- filters.fold<Filter , Filter ?>(null ) { acc, filter ->
120- acc?.let { it and filter } ? : filter
121- }
122119}
123120
124121@Deprecated(" Deprecated in favor of using a [FilterBuilder]" , replaceWith = ReplaceWith (" where { }" , " dev.gitlive.firebase.firestore" ))
125122fun 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()
129128 )
130- filters.fold<Filter , Filter ?>(null ) { acc, filter ->
131- acc?.let { it and filter } ? : filter
132- }
133129}
134130
135131fun Query.orderBy (field : String , direction : Direction = Direction .ASCENDING ) = _orderBy (field, direction)
0 commit comments