mirror of
https://github.com/InsanusMokrassar/MicroUtils.git
synced 2024-12-18 06:40:07 +00:00
update exposed version
This commit is contained in:
parent
805ab32b24
commit
7651388b5c
@ -2,6 +2,8 @@
|
||||
|
||||
## 0.20.26
|
||||
|
||||
* `Versions`:
|
||||
* `Exposed`: `0.45.0` -> `0.46.0`. **This update brinds new api deprecations in exposed**
|
||||
* `Resources`:
|
||||
* Add opportunity to get default translation by passing `null` as `IetfLang` argument
|
||||
* Add several useful extensions to get translations in `JS` target
|
||||
|
@ -7,7 +7,7 @@ kt-coroutines = "1.7.3"
|
||||
kslog = "1.3.1"
|
||||
|
||||
jb-compose = "1.5.11"
|
||||
jb-exposed = "0.45.0"
|
||||
jb-exposed = "0.46.0"
|
||||
jb-dokka = "1.9.10"
|
||||
|
||||
korlibs = "5.3.0"
|
||||
@ -26,7 +26,7 @@ kotlin-poet = "1.15.3"
|
||||
|
||||
versions = "0.50.0"
|
||||
|
||||
android-gradle = "8.2.0"
|
||||
android-gradle = "8.2.1"
|
||||
dexcount = "4.0.0"
|
||||
|
||||
android-coreKtx = "1.12.0"
|
||||
|
@ -35,14 +35,14 @@ abstract class AbstractExposedReadCRUDRepo<ObjectType, IdType>(
|
||||
}
|
||||
override suspend fun getById(id: IdType): ObjectType? {
|
||||
return transaction(db = database) {
|
||||
select {
|
||||
selectAll().where {
|
||||
selectById(id)
|
||||
}.limit(1).firstOrNull() ?.asObject
|
||||
}
|
||||
}
|
||||
|
||||
override suspend fun contains(id: IdType): Boolean = transaction(db = database) {
|
||||
select { selectById(id) }.limit(1).any()
|
||||
selectAll().where { selectById(id) }.limit(1).any()
|
||||
}
|
||||
|
||||
override suspend fun getAll(): Map<IdType, ObjectType> = transaction(database) {
|
||||
|
@ -101,7 +101,7 @@ abstract class AbstractExposedWriteCRUDRepo<ObjectType, IdType, InputValueType>(
|
||||
}.let {
|
||||
if (it > 0) {
|
||||
transaction(db = database) {
|
||||
select {
|
||||
selectAll().where {
|
||||
selectById(this, id)
|
||||
}.limit(1).firstOrNull() ?.asObject
|
||||
}
|
||||
@ -142,7 +142,7 @@ abstract class AbstractExposedWriteCRUDRepo<ObjectType, IdType, InputValueType>(
|
||||
ids
|
||||
} else {
|
||||
ids.filter {
|
||||
select { selectById(it) }.limit(1).none()
|
||||
selectAll().where { selectById(it) }.limit(1).none()
|
||||
}
|
||||
}
|
||||
}.forEach {
|
||||
|
@ -65,7 +65,7 @@ abstract class AbstractExposedKeyValueRepo<Key, Value>(
|
||||
override suspend fun unsetWithValues(toUnset: List<Value>) {
|
||||
transaction(database) {
|
||||
toUnset.flatMap {
|
||||
val keys = select { selectByValue(it) }.mapNotNull { it.asKey }
|
||||
val keys = selectAll().where { selectByValue(it) }.mapNotNull { it.asKey }
|
||||
deleteWhere { selectByIds(it, keys) }
|
||||
keys
|
||||
}
|
||||
|
@ -24,11 +24,11 @@ abstract class AbstractExposedReadKeyValueRepo<Key, Value>(
|
||||
abstract val selectByValue: ISqlExpressionBuilder.(Value) -> Op<Boolean>
|
||||
|
||||
override suspend fun get(k: Key): Value? = transaction(database) {
|
||||
select { selectById(k) }.limit(1).firstOrNull() ?.asObject
|
||||
selectAll().where { selectById(k) }.limit(1).firstOrNull() ?.asObject
|
||||
}
|
||||
|
||||
override suspend fun contains(key: Key): Boolean = transaction(database) {
|
||||
select { selectById(key) }.limit(1).any()
|
||||
selectAll().where { selectById(key) }.limit(1).any()
|
||||
}
|
||||
|
||||
override suspend fun getAll(): Map<Key, Value> = transaction(database) { selectAll().associate { it.asKey to it.asObject } }
|
||||
@ -46,7 +46,7 @@ abstract class AbstractExposedReadKeyValueRepo<Key, Value>(
|
||||
}
|
||||
|
||||
override suspend fun keys(v: Value, pagination: Pagination, reversed: Boolean): PaginationResult<Key> = transaction(database) {
|
||||
select { selectByValue(v) }.selectPaginated(
|
||||
selectAll().where { selectByValue(v) }.selectPaginated(
|
||||
pagination,
|
||||
keyColumn,
|
||||
reversed
|
||||
|
@ -65,7 +65,7 @@ open class ExposedKeyValueRepo<Key, Value>(
|
||||
override suspend fun unsetWithValues(toUnset: List<Value>) {
|
||||
transaction(database) {
|
||||
toUnset.flatMap {
|
||||
val keys = select { valueColumn.eq(it) }.mapNotNull { it[keyColumn] }
|
||||
val keys = selectAll().where { valueColumn.eq(it) }.mapNotNull { it[keyColumn] }
|
||||
deleteWhere { keyColumn.inList(keys) }
|
||||
keys
|
||||
}
|
||||
|
@ -29,7 +29,7 @@ abstract class AbstractExposedKeyValuesRepo<Key, Value>(
|
||||
transaction(database) {
|
||||
toAdd.keys.flatMap { k ->
|
||||
toAdd[k] ?.mapNotNull { v ->
|
||||
if (select { selectById(k).and(selectByValue(v)) }.limit(1).any()) {
|
||||
if (selectAll().where { selectById(k).and(selectByValue(v)) }.limit(1).any()) {
|
||||
return@mapNotNull null
|
||||
}
|
||||
val insertResult = insert {
|
||||
|
@ -19,7 +19,7 @@ abstract class AbstractExposedReadKeyValuesRepo<Key, Value>(
|
||||
get() = asKey
|
||||
abstract val selectByValue: ISqlExpressionBuilder.(Value) -> Op<Boolean>
|
||||
|
||||
override suspend fun count(k: Key): Long = transaction(database) { select { selectById(k) }.count() }
|
||||
override suspend fun count(k: Key): Long = transaction(database) { selectAll().where { selectById(k) }.count() }
|
||||
|
||||
override suspend fun count(): Long = transaction(database) { selectAll().count() }
|
||||
|
||||
@ -28,7 +28,7 @@ abstract class AbstractExposedReadKeyValuesRepo<Key, Value>(
|
||||
pagination: Pagination,
|
||||
reversed: Boolean
|
||||
): PaginationResult<Value> = transaction(database) {
|
||||
select { selectById(k) }.selectPaginated(
|
||||
selectAll().where { selectById(k) }.selectPaginated(
|
||||
pagination,
|
||||
keyColumn,
|
||||
reversed
|
||||
@ -55,7 +55,7 @@ abstract class AbstractExposedReadKeyValuesRepo<Key, Value>(
|
||||
pagination: Pagination,
|
||||
reversed: Boolean
|
||||
): PaginationResult<Key> = transaction(database) {
|
||||
select { selectByValue(v) }.selectPaginated(
|
||||
selectAll().where { selectByValue(v) }.selectPaginated(
|
||||
pagination,
|
||||
keyColumn,
|
||||
reversed
|
||||
@ -65,11 +65,11 @@ abstract class AbstractExposedReadKeyValuesRepo<Key, Value>(
|
||||
}
|
||||
|
||||
override suspend fun contains(k: Key): Boolean = transaction(database) {
|
||||
select { selectById(k) }.limit(1).any()
|
||||
selectAll().where { selectById(k) }.limit(1).any()
|
||||
}
|
||||
|
||||
override suspend fun contains(k: Key, v: Value): Boolean = transaction(database) {
|
||||
select { selectById(k).and(selectByValue(v)) }.limit(1).any()
|
||||
selectAll().where { selectById(k).and(selectByValue(v)) }.limit(1).any()
|
||||
}
|
||||
|
||||
override suspend fun getAll(reverseLists: Boolean): Map<Key, List<Value>> = transaction(database) {
|
||||
@ -85,9 +85,9 @@ abstract class AbstractExposedReadKeyValuesRepo<Key, Value>(
|
||||
|
||||
override suspend fun getAll(k: Key, reverseLists: Boolean): List<Value> = transaction(database) {
|
||||
val query = if (reverseLists) {
|
||||
select { selectById(k) }.orderBy(keyColumn, SortOrder.DESC)
|
||||
selectAll().where { selectById(k) }.orderBy(keyColumn, SortOrder.DESC)
|
||||
} else {
|
||||
select { selectById(k) }
|
||||
selectAll().where { selectById(k) }
|
||||
}
|
||||
query.map {
|
||||
it.asObject
|
||||
|
@ -34,7 +34,7 @@ open class ExposedKeyValuesRepo<Key, Value>(
|
||||
transaction(database) {
|
||||
toAdd.keys.flatMap { k ->
|
||||
toAdd[k] ?.mapNotNull { v ->
|
||||
if (select { keyColumn.eq(k).and(valueColumn.eq(v)) }.limit(1).count() > 0) {
|
||||
if (selectAll().where { keyColumn.eq(k).and(valueColumn.eq(v)) }.limit(1).count() > 0) {
|
||||
return@mapNotNull null
|
||||
}
|
||||
val insertResult = insert {
|
||||
@ -69,7 +69,7 @@ open class ExposedKeyValuesRepo<Key, Value>(
|
||||
|
||||
override suspend fun removeWithValue(v: Value) {
|
||||
transaction(database) {
|
||||
val keys = select { selectByValue(v) }.map { it.asKey }
|
||||
val keys = selectAll().where { selectByValue(v) }.map { it.asKey }
|
||||
deleteWhere { SqlExpressionBuilder.selectByValue(v) }
|
||||
keys
|
||||
}.forEach {
|
||||
@ -85,7 +85,7 @@ open class ExposedKeyValuesRepo<Key, Value>(
|
||||
|
||||
override suspend fun clearWithValue(v: Value) {
|
||||
transaction(database) {
|
||||
val toClear = select { selectByValue(v) }
|
||||
val toClear = selectAll().where { selectByValue(v) }
|
||||
.asSequence()
|
||||
.map { it.asKey to it.asObject }
|
||||
.groupBy { it.first }
|
||||
|
@ -26,7 +26,7 @@ class ExposedStandardVersionsRepoProxy(
|
||||
}
|
||||
|
||||
override suspend fun getTableVersion(tableName: String): Int? = transaction(database) {
|
||||
select { tableNameColumn.eq(tableName) }.limit(1).firstOrNull() ?.getOrNull(tableVersionColumn)
|
||||
selectAll().where { tableNameColumn.eq(tableName) }.limit(1).firstOrNull() ?.getOrNull(tableVersionColumn)
|
||||
}
|
||||
|
||||
override suspend fun updateTableVersion(tableName: String, version: Int) {
|
||||
|
Loading…
Reference in New Issue
Block a user