@@ -11,6 +11,7 @@ import kotlinx.serialization.KSerializer
11
11
import kotlinx.serialization.Serializable
12
12
import kotlinx.serialization.SerializationException
13
13
import kotlinx.serialization.SerializationStrategy
14
+ import kotlin.jvm.JvmInline
14
15
import kotlin.jvm.JvmName
15
16
16
17
/* * Returns the [FirebaseFirestore] instance of the default [FirebaseApp]. */
@@ -53,32 +54,32 @@ expect class Transaction {
53
54
suspend fun get (documentRef : DocumentReference ): DocumentSnapshot
54
55
}
55
56
56
- sealed class WhereClause {
57
+ internal sealed interface WhereClause {
57
58
58
- sealed class ForNullableObject : WhereClause () {
59
+ sealed interface ForNullableObject : WhereClause {
59
60
abstract val value: Any?
60
61
val safeValue get() = value?.safeValue
61
62
}
62
63
63
- sealed class ForObject : WhereClause () {
64
+ sealed interface ForObject : WhereClause {
64
65
abstract val value: Any
65
66
val safeValue get() = value.safeValue
66
67
}
67
- sealed class ForArray : WhereClause () {
68
+ sealed interface ForArray : WhereClause {
68
69
abstract val values: List <Any >
69
70
val safeValues get() = values.map { it.safeValue }
70
71
}
71
72
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
82
83
}
83
84
84
85
expect open class Query {
@@ -87,8 +88,8 @@ expect open class Query {
87
88
fun snapshots (includeMetadataChanges : Boolean = false): Flow <QuerySnapshot >
88
89
suspend fun get (): QuerySnapshot
89
90
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
92
93
93
94
internal fun _orderBy (field : String , direction : Direction ): Query
94
95
internal fun _orderBy (field : FieldPath , direction : Direction ): Query
@@ -115,8 +116,8 @@ private val Any.safeValue: Any get() = when (this) {
115
116
116
117
fun Query.where (field : String , equalTo : Any? ) = where(field, clause = WhereClause .EqualTo (equalTo))
117
118
fun 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())
120
121
fun Query.whereNot (field : String , notEqualTo : Any? ) = where(field, clause = WhereClause .NotEqualTo (notEqualTo))
121
122
fun Query.whereNot (path : FieldPath , notEqualTo : Any? ) = where(path, clause = WhereClause .NotEqualTo (notEqualTo))
122
123
fun Query.where (field : String ,
0 commit comments