SqlitePropertyStore

class SqlitePropertyStore(driver: ERROR CLASS: Symbol not found for SqlDriver, customSerializersModule: ERROR CLASS: Symbol not found for SerializersModule = SerializersModule {}) : <ERROR CLASS> ERROR CLASS: Symbol not found for AbstractPropertyStore(source)

SQLite-backed property store for persisting configuration properties.

Use this store when you need durable property storage with SQLite. Properties are serialized as JSON, enabling storage of any property type including custom implementations.

Optimistic Locking

Operations that update existing properties (such as updateProperty) use optimistic locking to prevent lost updates when multiple clients modify the same property concurrently. If a concurrent modification is detected, the operation retries automatically (up to 10 times) before failing.

Note: createOrUpdate performs a plain upsert with last-write-wins semantics and does not use optimistic locking.

Setup

You must create the database schema before using the store:

// JVM with in-memory database
val driver = JdbcSqliteDriver(JdbcSqliteDriver.IN_MEMORY)
SqliteDatabase.Schema.create(driver).await()
val store = SqlitePropertyStore(driver)

// Android
val driver = AndroidSqliteDriver(SqliteDatabase.Schema, context, "ff4k.db")
val store = SqlitePropertyStore(driver)

// iOS
val driver = NativeSqliteDriver(SqliteDatabase.Schema, "ff4k.db")
val store = SqlitePropertyStore(driver)

Custom Property Types

To store custom property implementations, provide a serializers module:

val customModule = SerializersModule {
polymorphic(Property::class) {
subclass(MyCustomProperty::class, MyCustomProperty.serializer())
}
}
val store = SqlitePropertyStore(driver, customModule)

Parameters

driver

The SQLDelight driver connected to your SQLite database.

customSerializersModule

Serializers for custom property types you want to store.

Constructors

Link copied to clipboard
constructor(driver: ERROR CLASS: Symbol not found for SqlDriver, customSerializersModule: ERROR CLASS: Symbol not found for SerializersModule = SerializersModule {})

Types

Link copied to clipboard
object Companion

Functions

Link copied to clipboard
open suspend override fun clear()
Link copied to clipboard
open suspend override fun contains(propertyId: String): Boolean
Link copied to clipboard
open suspend override fun <T> createOrUpdate(property: ERROR CLASS: Symbol not found for Property<T>)

Stores a property, creating it if new or updating it if it exists.

Link copied to clipboard
open suspend override fun <T> get(propertyId: String): ERROR CLASS: Symbol not found for Property<T>??
Link copied to clipboard
open suspend override fun getAll(): Map<String, ERROR CLASS: Symbol not found for Property<*>>
Link copied to clipboard
open suspend override fun <T> getOrDefault(propertyId: String, defaultValue: ERROR CLASS: Symbol not found for Property<T>): ERROR CLASS: Symbol not found for Property<T>
Link copied to clipboard
open suspend override fun isEmpty(): Boolean
Link copied to clipboard
open suspend override fun listPropertyIds(): Set<String>
Link copied to clipboard
open suspend override fun minusAssign(propertyId: String)
Link copied to clipboard
open suspend override fun <T> plusAssign(property: ERROR CLASS: Symbol not found for Property<T>)
Link copied to clipboard
open suspend override fun requirePropertyExist(name: String)
Link copied to clipboard
open suspend override fun requirePropertyNotExist(name: String)
Link copied to clipboard
open suspend override fun <T> updateProperty(property: ERROR CLASS: Symbol not found for Property<T>)
open suspend override fun <T> updateProperty(name: String, transform: (ERROR CLASS: Symbol not found for Property<T>) -> ERROR CLASS: Symbol not found for Property<T>)