File tree Expand file tree Collapse file tree 2 files changed +6
-2
lines changed
commonIntegrationTest/kotlin/com/powersync
commonMain/kotlin/com/powersync Expand file tree Collapse file tree 2 files changed +6
-2
lines changed Original file line number Diff line number Diff line change 1
1
package com.powersync
2
2
3
+ import app.cash.turbine.test
3
4
import app.cash.turbine.turbineScope
4
5
import co.touchlab.kermit.ExperimentalKermitApi
5
6
import com.powersync.db.ActiveDatabaseGroup
@@ -441,6 +442,9 @@ class DatabaseTest {
441
442
}
442
443
}
443
444
445
+ // Before inserting data, the flow should be empty
446
+ database.getCrudTransactions().test { awaitComplete() }
447
+
444
448
insertInTransaction(5 )
445
449
insertInTransaction(10 )
446
450
insertInTransaction(15 )
Original file line number Diff line number Diff line change @@ -137,7 +137,7 @@ public interface PowerSyncDatabase : Queries {
137
137
public suspend fun getNextCrudTransaction (): CrudTransaction ? = getCrudTransactions().firstOrNull()
138
138
139
139
/* *
140
- * Obtains a flow of transactions with local data against the database.
140
+ * Obtains a flow emitting completed transactions with local writes against the database.
141
141
142
142
* This is typically used from the [PowerSyncBackendConnector.uploadData] callback.
143
143
* Each entry emitted by the returned flow is a full transaction containing all local writes
@@ -154,7 +154,7 @@ public interface PowerSyncDatabase : Queries {
154
154
* val batch = mutableListOf<CrudEntry>()
155
155
* var lastTx: CrudTransaction? = null
156
156
*
157
- * database.getCrudTransactions().takeWhile { batch.size < 10 }.collect {
157
+ * database.getCrudTransactions().takeWhile { batch.size < 100 }.collect {
158
158
* batch.addAll(it.crud)
159
159
* lastTx = it
160
160
* }
You can’t perform that action at this time.
0 commit comments