Skip to content

Commit 9bc6763

Browse files
committed
add Firestore.collectionGroup
1 parent ae90c6d commit 9bc6763

File tree

5 files changed

+8
-0
lines changed
  • firebase-common/src/jsMain/kotlin/dev/gitlive/firebase
  • firebase-firestore/src

5 files changed

+8
-0
lines changed

firebase-common/src/jsMain/kotlin/dev/gitlive/firebase/externals.kt

+1
Original file line numberDiff line numberDiff line change
@@ -339,6 +339,7 @@ external object firebase {
339339
fun <T> runTransaction(func: (transaction: Transaction) -> Promise<T>): Promise<T>
340340
fun batch(): WriteBatch
341341
fun collection(collectionPath: String): CollectionReference
342+
fun collectionGroup(collectionId: String): Query
342343
fun doc(documentPath: String): DocumentReference
343344
fun settings(settings: Json)
344345
fun enablePersistence(): Promise<Unit>

firebase-firestore/src/androidMain/kotlin/dev/gitlive/firebase/firestore/firestore.kt

+2
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,8 @@ actual class FirebaseFirestore(val android: com.google.firebase.firestore.Fireba
4040

4141
actual fun collection(collectionPath: String) = CollectionReference(android.collection(collectionPath))
4242

43+
actual fun collectionGroup(collectionId: String) = Query(android.collectionGroup(collectionId))
44+
4345
actual fun document(documentPath: String) = DocumentReference(android.document(documentPath))
4446

4547
actual fun batch() = WriteBatch(android.batch())

firebase-firestore/src/commonMain/kotlin/dev/gitlive/firebase/firestore/firestore.kt

+1
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@ expect fun Firebase.firestore(app: FirebaseApp): FirebaseFirestore
2020

2121
expect class FirebaseFirestore {
2222
fun collection(collectionPath: String): CollectionReference
23+
fun collectionGroup(collectionId: String): Query
2324
fun document(documentPath: String): DocumentReference
2425
fun batch(): WriteBatch
2526
fun setLoggingEnabled(loggingEnabled: Boolean)

firebase-firestore/src/iosMain/kotlin/dev/gitlive/firebase/firestore/firestore.kt

+2
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,8 @@ actual class FirebaseFirestore(val ios: FIRFirestore) {
4242

4343
actual fun collection(collectionPath: String) = CollectionReference(ios.collectionWithPath(collectionPath))
4444

45+
actual fun collectionGroup(collectionId: String) = Query(ios.collectionGroupWithId(collectionId))
46+
4547
actual fun document(documentPath: String) = DocumentReference(ios.documentWithPath(documentPath))
4648

4749
actual fun batch() = WriteBatch(ios.batch())

firebase-firestore/src/jsMain/kotlin/dev/gitlive/firebase/firestore/firestore.kt

+2
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,8 @@ actual class FirebaseFirestore(val js: firebase.firestore.Firestore) {
3838

3939
actual fun collection(collectionPath: String) = rethrow { CollectionReference(js.collection(collectionPath)) }
4040

41+
actual fun collectionGroup(collectionId: String) = Query(js.collectionGroup(collectionId))
42+
4143
actual fun document(documentPath: String) = rethrow { DocumentReference(js.doc(documentPath)) }
4244

4345
actual fun batch() = rethrow { WriteBatch(js.batch()) }

0 commit comments

Comments
 (0)