From 7651388b5ce38b13473bf22f8eae5a7f95bd6b11 Mon Sep 17 00:00:00 2001 From: InsanusMokrassar Date: Thu, 11 Jan 2024 23:09:17 +0600 Subject: [PATCH] update exposed version --- CHANGELOG.md | 2 ++ gradle/libs.versions.toml | 4 ++-- .../repos/exposed/AbstractExposedReadCRUDRepo.kt | 4 ++-- .../repos/exposed/AbstractExposedWriteCRUDRepo.kt | 4 ++-- .../keyvalue/AbstractExposedKeyValueRepo.kt | 2 +- .../keyvalue/AbstractExposedReadKeyValueRepo.kt | 6 +++--- .../repos/exposed/keyvalue/ExposedKeyValueRepo.kt | 2 +- .../onetomany/AbstractExposedKeyValuesRepo.kt | 2 +- .../onetomany/AbstractExposedReadKeyValuesRepo.kt | 14 +++++++------- .../exposed/onetomany/ExposedKeyValuesRepo.kt | 6 +++--- .../versions/ExposedStandardVersionsRepoProxy.kt | 2 +- 11 files changed, 25 insertions(+), 23 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 65ba75c06f2..155768d8c03 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -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 diff --git a/gradle/libs.versions.toml b/gradle/libs.versions.toml index d3185e3bfd2..74f240c39d4 100644 --- a/gradle/libs.versions.toml +++ b/gradle/libs.versions.toml @@ -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" diff --git a/repos/exposed/src/jvmMain/kotlin/dev/inmo/micro_utils/repos/exposed/AbstractExposedReadCRUDRepo.kt b/repos/exposed/src/jvmMain/kotlin/dev/inmo/micro_utils/repos/exposed/AbstractExposedReadCRUDRepo.kt index 793fddc0536..86585fac4d6 100644 --- a/repos/exposed/src/jvmMain/kotlin/dev/inmo/micro_utils/repos/exposed/AbstractExposedReadCRUDRepo.kt +++ b/repos/exposed/src/jvmMain/kotlin/dev/inmo/micro_utils/repos/exposed/AbstractExposedReadCRUDRepo.kt @@ -35,14 +35,14 @@ abstract class AbstractExposedReadCRUDRepo( } 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 = transaction(database) { diff --git a/repos/exposed/src/jvmMain/kotlin/dev/inmo/micro_utils/repos/exposed/AbstractExposedWriteCRUDRepo.kt b/repos/exposed/src/jvmMain/kotlin/dev/inmo/micro_utils/repos/exposed/AbstractExposedWriteCRUDRepo.kt index 21823daa50f..083ccb075b6 100644 --- a/repos/exposed/src/jvmMain/kotlin/dev/inmo/micro_utils/repos/exposed/AbstractExposedWriteCRUDRepo.kt +++ b/repos/exposed/src/jvmMain/kotlin/dev/inmo/micro_utils/repos/exposed/AbstractExposedWriteCRUDRepo.kt @@ -101,7 +101,7 @@ abstract class AbstractExposedWriteCRUDRepo( }.let { if (it > 0) { transaction(db = database) { - select { + selectAll().where { selectById(this, id) }.limit(1).firstOrNull() ?.asObject } @@ -142,7 +142,7 @@ abstract class AbstractExposedWriteCRUDRepo( ids } else { ids.filter { - select { selectById(it) }.limit(1).none() + selectAll().where { selectById(it) }.limit(1).none() } } }.forEach { diff --git a/repos/exposed/src/jvmMain/kotlin/dev/inmo/micro_utils/repos/exposed/keyvalue/AbstractExposedKeyValueRepo.kt b/repos/exposed/src/jvmMain/kotlin/dev/inmo/micro_utils/repos/exposed/keyvalue/AbstractExposedKeyValueRepo.kt index 591d1b6ce42..aade9f36a6e 100644 --- a/repos/exposed/src/jvmMain/kotlin/dev/inmo/micro_utils/repos/exposed/keyvalue/AbstractExposedKeyValueRepo.kt +++ b/repos/exposed/src/jvmMain/kotlin/dev/inmo/micro_utils/repos/exposed/keyvalue/AbstractExposedKeyValueRepo.kt @@ -65,7 +65,7 @@ abstract class AbstractExposedKeyValueRepo( override suspend fun unsetWithValues(toUnset: List) { 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 } diff --git a/repos/exposed/src/jvmMain/kotlin/dev/inmo/micro_utils/repos/exposed/keyvalue/AbstractExposedReadKeyValueRepo.kt b/repos/exposed/src/jvmMain/kotlin/dev/inmo/micro_utils/repos/exposed/keyvalue/AbstractExposedReadKeyValueRepo.kt index 37379a11d2d..6d8b11a9e9f 100644 --- a/repos/exposed/src/jvmMain/kotlin/dev/inmo/micro_utils/repos/exposed/keyvalue/AbstractExposedReadKeyValueRepo.kt +++ b/repos/exposed/src/jvmMain/kotlin/dev/inmo/micro_utils/repos/exposed/keyvalue/AbstractExposedReadKeyValueRepo.kt @@ -24,11 +24,11 @@ abstract class AbstractExposedReadKeyValueRepo( abstract val selectByValue: ISqlExpressionBuilder.(Value) -> Op 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 = transaction(database) { selectAll().associate { it.asKey to it.asObject } } @@ -46,7 +46,7 @@ abstract class AbstractExposedReadKeyValueRepo( } override suspend fun keys(v: Value, pagination: Pagination, reversed: Boolean): PaginationResult = transaction(database) { - select { selectByValue(v) }.selectPaginated( + selectAll().where { selectByValue(v) }.selectPaginated( pagination, keyColumn, reversed diff --git a/repos/exposed/src/jvmMain/kotlin/dev/inmo/micro_utils/repos/exposed/keyvalue/ExposedKeyValueRepo.kt b/repos/exposed/src/jvmMain/kotlin/dev/inmo/micro_utils/repos/exposed/keyvalue/ExposedKeyValueRepo.kt index be470089c71..3bfe88f1dcd 100644 --- a/repos/exposed/src/jvmMain/kotlin/dev/inmo/micro_utils/repos/exposed/keyvalue/ExposedKeyValueRepo.kt +++ b/repos/exposed/src/jvmMain/kotlin/dev/inmo/micro_utils/repos/exposed/keyvalue/ExposedKeyValueRepo.kt @@ -65,7 +65,7 @@ open class ExposedKeyValueRepo( override suspend fun unsetWithValues(toUnset: List) { 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 } diff --git a/repos/exposed/src/jvmMain/kotlin/dev/inmo/micro_utils/repos/exposed/onetomany/AbstractExposedKeyValuesRepo.kt b/repos/exposed/src/jvmMain/kotlin/dev/inmo/micro_utils/repos/exposed/onetomany/AbstractExposedKeyValuesRepo.kt index d63f99bc704..736860575e5 100644 --- a/repos/exposed/src/jvmMain/kotlin/dev/inmo/micro_utils/repos/exposed/onetomany/AbstractExposedKeyValuesRepo.kt +++ b/repos/exposed/src/jvmMain/kotlin/dev/inmo/micro_utils/repos/exposed/onetomany/AbstractExposedKeyValuesRepo.kt @@ -29,7 +29,7 @@ abstract class AbstractExposedKeyValuesRepo( 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 { diff --git a/repos/exposed/src/jvmMain/kotlin/dev/inmo/micro_utils/repos/exposed/onetomany/AbstractExposedReadKeyValuesRepo.kt b/repos/exposed/src/jvmMain/kotlin/dev/inmo/micro_utils/repos/exposed/onetomany/AbstractExposedReadKeyValuesRepo.kt index 52e959f77db..1864ee0581d 100644 --- a/repos/exposed/src/jvmMain/kotlin/dev/inmo/micro_utils/repos/exposed/onetomany/AbstractExposedReadKeyValuesRepo.kt +++ b/repos/exposed/src/jvmMain/kotlin/dev/inmo/micro_utils/repos/exposed/onetomany/AbstractExposedReadKeyValuesRepo.kt @@ -19,7 +19,7 @@ abstract class AbstractExposedReadKeyValuesRepo( get() = asKey abstract val selectByValue: ISqlExpressionBuilder.(Value) -> Op - 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( pagination: Pagination, reversed: Boolean ): PaginationResult = transaction(database) { - select { selectById(k) }.selectPaginated( + selectAll().where { selectById(k) }.selectPaginated( pagination, keyColumn, reversed @@ -55,7 +55,7 @@ abstract class AbstractExposedReadKeyValuesRepo( pagination: Pagination, reversed: Boolean ): PaginationResult = transaction(database) { - select { selectByValue(v) }.selectPaginated( + selectAll().where { selectByValue(v) }.selectPaginated( pagination, keyColumn, reversed @@ -65,11 +65,11 @@ abstract class AbstractExposedReadKeyValuesRepo( } 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> = transaction(database) { @@ -85,9 +85,9 @@ abstract class AbstractExposedReadKeyValuesRepo( override suspend fun getAll(k: Key, reverseLists: Boolean): List = 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 diff --git a/repos/exposed/src/jvmMain/kotlin/dev/inmo/micro_utils/repos/exposed/onetomany/ExposedKeyValuesRepo.kt b/repos/exposed/src/jvmMain/kotlin/dev/inmo/micro_utils/repos/exposed/onetomany/ExposedKeyValuesRepo.kt index 456f2c3106d..1688a52503e 100644 --- a/repos/exposed/src/jvmMain/kotlin/dev/inmo/micro_utils/repos/exposed/onetomany/ExposedKeyValuesRepo.kt +++ b/repos/exposed/src/jvmMain/kotlin/dev/inmo/micro_utils/repos/exposed/onetomany/ExposedKeyValuesRepo.kt @@ -34,7 +34,7 @@ open class ExposedKeyValuesRepo( 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( 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( 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 } diff --git a/repos/exposed/src/jvmMain/kotlin/dev/inmo/micro_utils/repos/exposed/versions/ExposedStandardVersionsRepoProxy.kt b/repos/exposed/src/jvmMain/kotlin/dev/inmo/micro_utils/repos/exposed/versions/ExposedStandardVersionsRepoProxy.kt index 6d4836a49e2..e193eb4a0f7 100644 --- a/repos/exposed/src/jvmMain/kotlin/dev/inmo/micro_utils/repos/exposed/versions/ExposedStandardVersionsRepoProxy.kt +++ b/repos/exposed/src/jvmMain/kotlin/dev/inmo/micro_utils/repos/exposed/versions/ExposedStandardVersionsRepoProxy.kt @@ -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) {