SqliteFeatureStore

class SqliteFeatureStore(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 AbstractFeatureStore(source)

A com.yonatankarp.ff4k.core.FeatureStore implementation backed by SQLite.

Stores feature flags in a SQLite database using SQLDelight for type-safe queries. Complex fields like permissions, flipping strategies, and custom properties are serialized as JSON. All mutating operations use database transactions to ensure atomicity and prevent race conditions.

Example usage:

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

// Android with file-based database
val driver = AndroidSqliteDriver(SqliteDatabase.Schema, context, "features.db")
val store = SqliteFeatureStore(driver)

// iOS with file-based database
val driver = NativeSqliteDriver(SqliteDatabase.Schema, "features.db")
val store = SqliteFeatureStore(driver)

For custom com.yonatankarp.ff4k.core.FlippingStrategy or com.yonatankarp.ff4k.property.Property implementations, provide a custom serializers module:

val customModule = SerializersModule {
polymorphic(FlippingStrategy::class) {
subclass(MyCustomStrategy::class, MyCustomStrategy.serializer())
}
}
val store = SqliteFeatureStore(driver, customModule)

Parameters

driver

The SQLDelight SqlDriver connected to the SQLite database. The database schema must be created before use.

customSerializersModule

Optional serializers for custom com.yonatankarp.ff4k.core.FlippingStrategy or com.yonatankarp.ff4k.property.Property implementations. Merged with built-in FF4K serializers.

See also

com.yonatankarp.ff4k.core.FeatureStore

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(featureId: String): Boolean
Link copied to clipboard
open suspend override fun count(): Int
Link copied to clipboard
open suspend override fun createOrUpdate(feature: ERROR CLASS: Symbol not found for Feature)
Link copied to clipboard
open suspend override fun get(featureId: String): ERROR CLASS: Symbol not found for Feature??
Link copied to clipboard
open suspend override fun getAll(): Map<String, ERROR CLASS: Symbol not found for Feature>
Link copied to clipboard
open suspend override fun isEmpty(): Boolean
Link copied to clipboard
open suspend override fun minusAssign(featureId: String)
Link copied to clipboard
open suspend override fun plusAssign(feature: ERROR CLASS: Symbol not found for Feature)
Link copied to clipboard
open suspend override fun update(feature: ERROR CLASS: Symbol not found for Feature)
open suspend override fun update(featureId: String, transform: (ERROR CLASS: Symbol not found for Feature) -> ERROR CLASS: Symbol not found for Feature)