Replies: 1 comment 1 reply
-
This would be my approach for exporting the database: import com.squareup.sqldelight.db.SqlDriver
import com.squareup.sqldelight.drivers.sqljs.Database
import com.squareup.sqldelight.drivers.sqljs.JsSqlDriver
import com.squareup.sqldelight.drivers.sqljs.initDb
@JsExport
fun databaseExportTest() {
initDb().then {
val db: Database = it
val driver: SqlDriver = JsSqlDriver(db)
SqldelightDatabase.Schema.create(driver)
// Do stuff with driver as usual
// For exporting
println(
db.export()
)
}
} No idea how to do importing yet. Maybe by altering the call to Or maybe passing an (I'm working on this together with OP) |
Beta Was this translation helpful? Give feedback.
1 reply
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
We are currently trying to achieve persistence in the browser with the JsSqlDriver.
For this we want to export the current database as Uint8Array as can be seen in this part of the sqldelight codebase and sync this returned array to our cloud storage.
It is sadly unclear to us how you are supposed to call the
export()
function (how do I get access to the Database object?) and how to put the resulting array into the Database constructor when initializing the database next time.Thank you for any help!
Beta Was this translation helpful? Give feedback.
All reactions