mirror of
https://github.com/InsanusMokrassar/MicroUtils.git
synced 2024-11-26 03:58:45 +00:00
remove onInit()
This commit is contained in:
parent
82b39baada
commit
d34c5d845a
@ -5,6 +5,4 @@ import org.jetbrains.exposed.sql.Database
|
|||||||
|
|
||||||
interface ExposedRepo : Repo {
|
interface ExposedRepo : Repo {
|
||||||
val database: Database
|
val database: Database
|
||||||
|
|
||||||
fun onInit()
|
|
||||||
}
|
}
|
@ -24,7 +24,7 @@ open class ExposedKeyValueRepo<Key, Value>(
|
|||||||
override val onNewValue: Flow<Pair<Key, Value>> = onNewValueChannel.asFlow()
|
override val onNewValue: Flow<Pair<Key, Value>> = onNewValueChannel.asFlow()
|
||||||
override val onValueRemoved: Flow<Key> = onValueRemovedChannel.asFlow()
|
override val onValueRemoved: Flow<Key> = onValueRemovedChannel.asFlow()
|
||||||
|
|
||||||
override fun onInit() { initTable() }
|
init { initTable() }
|
||||||
|
|
||||||
override suspend fun set(k: Key, v: Value) {
|
override suspend fun set(k: Key, v: Value) {
|
||||||
transaction(database) {
|
transaction(database) {
|
||||||
|
@ -15,7 +15,7 @@ open class ExposedReadKeyValueRepo<Key, Value>(
|
|||||||
protected val valueColumn: Column<Value> = valueColumnAllocator()
|
protected val valueColumn: Column<Value> = valueColumnAllocator()
|
||||||
override val primaryKey: PrimaryKey = PrimaryKey(keyColumn, valueColumn)
|
override val primaryKey: PrimaryKey = PrimaryKey(keyColumn, valueColumn)
|
||||||
|
|
||||||
override fun onInit() { initTable() }
|
init { initTable() }
|
||||||
|
|
||||||
override suspend fun get(k: Key): Value? = transaction(database) {
|
override suspend fun get(k: Key): Value? = transaction(database) {
|
||||||
select { keyColumn.eq(k) }.limit(1).firstOrNull() ?.getOrNull(valueColumn)
|
select { keyColumn.eq(k) }.limit(1).firstOrNull() ?.getOrNull(valueColumn)
|
||||||
|
@ -27,7 +27,7 @@ open class ExposedOneToManyKeyValueRepo<Key, Value>(
|
|||||||
override val onDataCleared: Flow<Key>
|
override val onDataCleared: Flow<Key>
|
||||||
get() = _onDataCleared
|
get() = _onDataCleared
|
||||||
|
|
||||||
override fun onInit() { initTable() }
|
init { initTable() }
|
||||||
|
|
||||||
override suspend fun add(k: Key, v: Value) {
|
override suspend fun add(k: Key, v: Value) {
|
||||||
transaction(database) {
|
transaction(database) {
|
||||||
|
@ -14,7 +14,7 @@ open class ExposedReadOneToManyKeyValueRepo<Key, Value>(
|
|||||||
protected val keyColumn: Column<Key> = keyColumnAllocator()
|
protected val keyColumn: Column<Key> = keyColumnAllocator()
|
||||||
protected val valueColumn: Column<Value> = valueColumnAllocator()
|
protected val valueColumn: Column<Value> = valueColumnAllocator()
|
||||||
|
|
||||||
override fun onInit() { initTable() }
|
init { initTable() }
|
||||||
|
|
||||||
override suspend fun count(k: Key): Long = transaction(database) { select { keyColumn.eq(k) }.count() }
|
override suspend fun count(k: Key): Long = transaction(database) { select { keyColumn.eq(k) }.count() }
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user