@@ -11,6 +11,7 @@ import kotlinx.serialization.KSerializer
1111import kotlinx.serialization.Serializable
1212import kotlinx.serialization.SerializationException
1313import kotlinx.serialization.SerializationStrategy
14+ import kotlin.jvm.JvmInline
1415import kotlin.jvm.JvmName
1516
1617/* * Returns the [FirebaseFirestore] instance of the default [FirebaseApp]. */
@@ -53,32 +54,32 @@ expect class Transaction {
5354 suspend fun get (documentRef : DocumentReference ): DocumentSnapshot
5455}
5556
56- sealed class WhereClause {
57+ internal sealed interface WhereClause {
5758
58- sealed class ForNullableObject : WhereClause () {
59+ sealed interface ForNullableObject : WhereClause {
5960 abstract val value: Any?
6061 val safeValue get() = value?.safeValue
6162 }
6263
63- sealed class ForObject : WhereClause () {
64+ sealed interface ForObject : WhereClause {
6465 abstract val value: Any
6566 val safeValue get() = value.safeValue
6667 }
67- sealed class ForArray : WhereClause () {
68+ sealed interface ForArray : WhereClause {
6869 abstract val values: List <Any >
6970 val safeValues get() = values.map { it.safeValue }
7071 }
7172
72- data class EqualTo (override val value : Any? ) : ForNullableObject()
73- data class NotEqualTo (override val value : Any? ) : ForNullableObject()
74- data class LessThan (override val value : Any ) : ForObject()
75- data class GreaterThan (override val value : Any ) : ForObject()
76- data class LessThanOrEqualTo (override val value : Any ) : ForObject()
77- data class GreaterThanOrEqualTo (override val value : Any ) : ForObject()
78- data class ArrayContains (override val value : Any ) : ForObject()
79- data class InArray (override val values : List <Any >) : ForArray()
80- data class ArrayContainsAny (override val values : List <Any >) : ForArray()
81- data class NotInArray (override val values : List <Any >) : ForArray()
73+ data class EqualTo (override val value : Any? ) : ForNullableObject
74+ data class NotEqualTo (override val value : Any? ) : ForNullableObject
75+ data class LessThan (override val value : Any ) : ForObject
76+ data class GreaterThan (override val value : Any ) : ForObject
77+ data class LessThanOrEqualTo (override val value : Any ) : ForObject
78+ data class GreaterThanOrEqualTo (override val value : Any ) : ForObject
79+ data class ArrayContains (override val value : Any ) : ForObject
80+ data class InArray (override val values : List <Any >) : ForArray
81+ data class ArrayContainsAny (override val values : List <Any >) : ForArray
82+ data class NotInArray (override val values : List <Any >) : ForArray
8283}
8384
8485expect open class Query {
@@ -87,8 +88,8 @@ expect open class Query {
8788 fun snapshots (includeMetadataChanges : Boolean = false): Flow <QuerySnapshot >
8889 suspend fun get (): QuerySnapshot
8990
90- fun where (field : String , vararg clauses : WhereClause ): Query
91- fun where (path : FieldPath , vararg clauses : WhereClause ): Query
91+ internal fun where (field : String , vararg clauses : WhereClause ): Query
92+ internal fun where (path : FieldPath , vararg clauses : WhereClause ): Query
9293
9394 internal fun _orderBy (field : String , direction : Direction ): Query
9495 internal fun _orderBy (field : FieldPath , direction : Direction ): Query
@@ -115,8 +116,8 @@ private val Any.safeValue: Any get() = when (this) {
115116
116117fun Query.where (field : String , equalTo : Any? ) = where(field, clause = WhereClause .EqualTo (equalTo))
117118fun Query.where (path : FieldPath , equalTo : Any? ) = where(path, clause = WhereClause .EqualTo (equalTo))
118- fun Query.where (field : String , clause : WhereClause ): Query = where(field, clauses = listOf (clause).toTypedArray())
119- fun Query.where (path : FieldPath , clause : WhereClause ): Query = where(path, clauses = listOf (clause).toTypedArray())
119+ private fun Query.where (field : String , clause : WhereClause ): Query = where(field, clauses = listOf (clause).toTypedArray())
120+ private fun Query.where (path : FieldPath , clause : WhereClause ): Query = where(path, clauses = listOf (clause).toTypedArray())
120121fun Query.whereNot (field : String , notEqualTo : Any? ) = where(field, clause = WhereClause .NotEqualTo (notEqualTo))
121122fun Query.whereNot (path : FieldPath , notEqualTo : Any? ) = where(path, clause = WhereClause .NotEqualTo (notEqualTo))
122123fun Query.where (field : String ,
0 commit comments