SqliteStorage

class SqliteStorage(connection: <Error class: unknown class>, clock: <Error class: unknown class> = Clock.System, coroutineContext: CoroutineContext = Dispatchers.IO, keySize: Int = 9)

Storage implementation based on Kotlin Multiplatform SQLiteConnection API.

One limitation of SQLiteConnection APIs is that there is no way to get result from UPDATE and DELETE SQL statements. This can be worked around either using SQLite-specific RETURNING clause (without breaking atomicity) or by additional SELECT statements (this does break atomicity).

Note: currently we use this implementation only for iOS as there are multiple problems using this code on Android:

  • required androidx.sqlite library version (2.5.0-alpha12) conflicts with some other commonly used Android libraries.

  • implementation supplied by AndroidSQLiteDriver lacks support for SQLite-specific RETURNING clause and thus it is not possible to guarantee truly atomic operations (most notably insertions with unique keys and correct return value from deletions).

Constructors

Link copied to clipboard
constructor(connection: <Error class: unknown class>, clock: <Error class: unknown class> = Clock.System, coroutineContext: CoroutineContext = Dispatchers.IO, keySize: Int = 9)

Functions

Link copied to clipboard
open suspend fun createTable(tableSpec: <Error class: unknown class>): <Error class: unknown class>