jdbcFeatureStore

suspend fun jdbcFeatureStore(dataSource: DataSource, customSerializersModule: SerializersModule = SerializersModule {}, ioDispatcher: CoroutineDispatcher = Dispatchers.IO): FeatureStore(source)

Creates a JDBC-backed FeatureStore that auto-detects the database type.

The database type is detected using JDBC metadata from the DataSource. The feature table is created automatically if it doesn't exist.

Example:

val store = jdbcFeatureStore(HikariDataSource(config))
store += Feature(uid = "my-feature", isEnabled = true)

For custom FlippingStrategy or Property implementations:

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

Parameters

dataSource

The JDBC DataSource for database connections.

customSerializersModule

Optional serializers for custom types.

ioDispatcher

The CoroutineDispatcher to use for blocking JDBC operations. Defaults to Dispatchers.IO.

Throws

If the database type is not supported.


suspend fun jdbcFeatureStore(dataSource: DataSource, dialect: SqlDialect, customSerializersModule: SerializersModule = SerializersModule {}, ioDispatcher: CoroutineDispatcher = Dispatchers.IO): FeatureStore(source)

Creates a JDBC-backed FeatureStore with an explicit SQL dialect.

Use this when automatic detection doesn't work (e.g., database proxies).

Parameters

dataSource

The JDBC DataSource for database connections.

dialect

The SqlDialect for SQL statements.

customSerializersModule

Optional serializers for custom types.

ioDispatcher

The CoroutineDispatcher to use for blocking JDBC operations. Defaults to Dispatchers.IO.