Skip to content

Commit

Permalink
refactor: convert deprecated .await() to .coAwait()
Browse files Browse the repository at this point in the history
  • Loading branch information
duruer committed Feb 7, 2025
1 parent c853879 commit 8b65160
Show file tree
Hide file tree
Showing 23 changed files with 288 additions and 288 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ package com.panomc.platform.db.implementation
import com.panomc.platform.annotation.Dao
import com.panomc.platform.db.dao.AddonHashDao
import com.panomc.platform.db.model.AddonHash
import io.vertx.kotlin.coroutines.await
import io.vertx.kotlin.coroutines.coAwait
import io.vertx.mysqlclient.MySQLClient
import io.vertx.sqlclient.Row
import io.vertx.sqlclient.RowSet
Expand All @@ -26,7 +26,7 @@ class AddonHashDaoImpl : AddonHashDao() {
"""
)
.execute()
.await()
.coAwait()
}

override suspend fun add(
Expand All @@ -44,7 +44,7 @@ class AddonHashDaoImpl : AddonHashDao() {
addonHash.hash,
addonHash.status
)
).await()
).coAwait()

return rows.property(MySQLClient.LAST_INSERTED_ID)
}
Expand Down Expand Up @@ -72,7 +72,7 @@ class AddonHashDaoImpl : AddonHashDao() {
val rows: RowSet<Row> = sqlClient
.preparedQuery(query)
.execute()
.await()
.coAwait()

val listOfAddonHash = mutableMapOf<String, AddonHash>()

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import com.panomc.platform.annotation.Dao
import com.panomc.platform.db.dao.NotificationDao
import com.panomc.platform.db.model.Notification
import com.panomc.platform.notification.NotificationStatus
import io.vertx.kotlin.coroutines.await
import io.vertx.kotlin.coroutines.coAwait
import io.vertx.sqlclient.Row
import io.vertx.sqlclient.RowSet
import io.vertx.sqlclient.SqlClient
Expand All @@ -29,7 +29,7 @@ class NotificationDaoImpl : NotificationDao() {
"""
)
.execute()
.await()
.coAwait()
}

override suspend fun add(
Expand All @@ -50,7 +50,7 @@ class NotificationDaoImpl : NotificationDao() {
notification.date,
notification.status
)
).await()
).coAwait()
}

override suspend fun addAll(notifications: List<Notification>, sqlClient: SqlClient) {
Expand All @@ -77,7 +77,7 @@ class NotificationDaoImpl : NotificationDao() {
sqlClient
.preparedQuery(query)
.execute(tuple)
.await()
.coAwait()
}

override suspend fun getCountOfNotReadByUserId(
Expand All @@ -94,7 +94,7 @@ class NotificationDaoImpl : NotificationDao() {
userId,
NotificationStatus.NOT_READ,
)
).await()
).coAwait()

return rows.toList()[0].getLong(0)
}
Expand All @@ -112,7 +112,7 @@ class NotificationDaoImpl : NotificationDao() {
Tuple.of(
userId
)
).await()
).coAwait()

return rows.toList()[0].getLong(0)
}
Expand All @@ -130,7 +130,7 @@ class NotificationDaoImpl : NotificationDao() {
Tuple.of(
userId
)
).await()
).coAwait()

return rows.toEntities()
}
Expand All @@ -150,7 +150,7 @@ class NotificationDaoImpl : NotificationDao() {
userId,
notificationId
)
).await()
).coAwait()

return rows.toEntities()
}
Expand All @@ -169,7 +169,7 @@ class NotificationDaoImpl : NotificationDao() {
NotificationStatus.READ,
userId
)
).await()
).coAwait()
}

override suspend fun markReadLast10StartFromId(
Expand All @@ -188,7 +188,7 @@ class NotificationDaoImpl : NotificationDao() {
userId,
notificationId
)
).await()
).coAwait()
}

override suspend fun getLast5ByUserId(
Expand All @@ -204,7 +204,7 @@ class NotificationDaoImpl : NotificationDao() {
Tuple.of(
userId
)
).await()
).coAwait()

return rows.toEntities()
}
Expand All @@ -223,7 +223,7 @@ class NotificationDaoImpl : NotificationDao() {
NotificationStatus.READ,
userId
)
).await()
).coAwait()
}

override suspend fun existsById(
Expand All @@ -235,7 +235,7 @@ class NotificationDaoImpl : NotificationDao() {
val rows: RowSet<Row> = sqlClient
.preparedQuery(query)
.execute(Tuple.of(id))
.await()
.coAwait()

return rows.toList()[0].getLong(0) == 1L
}
Expand All @@ -253,7 +253,7 @@ class NotificationDaoImpl : NotificationDao() {
Tuple.of(
id
)
).await()
).coAwait()

if (rows.size() == 0) {
return null
Expand All @@ -277,7 +277,7 @@ class NotificationDaoImpl : NotificationDao() {
Tuple.of(
id
)
).await()
).coAwait()
}

override suspend fun markReadById(id: Long, sqlClient: SqlClient) {
Expand All @@ -291,7 +291,7 @@ class NotificationDaoImpl : NotificationDao() {
NotificationStatus.READ,
id
)
).await()
).coAwait()
}

override suspend fun deleteAllByUserId(
Expand All @@ -308,6 +308,6 @@ class NotificationDaoImpl : NotificationDao() {
userId
)
)
.await()
.coAwait()
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ package com.panomc.platform.db.implementation
import com.panomc.platform.annotation.Dao
import com.panomc.platform.db.dao.PanelActivityLogDao
import com.panomc.platform.db.model.PanelActivityLog
import io.vertx.kotlin.coroutines.await
import io.vertx.kotlin.coroutines.coAwait
import io.vertx.mysqlclient.MySQLClient
import io.vertx.sqlclient.Row
import io.vertx.sqlclient.RowSet
Expand Down Expand Up @@ -34,7 +34,7 @@ class PanelActivityLogDaoImpl : PanelActivityLogDao() {
"""
)
.execute()
.await()
.coAwait()
}

override suspend fun add(
Expand All @@ -55,7 +55,7 @@ class PanelActivityLogDaoImpl : PanelActivityLogDao() {
panelActivityLog.createdAt,
panelActivityLog.updatedAt,
)
).await()
).coAwait()

return rows.property(MySQLClient.LAST_INSERTED_ID)
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ package com.panomc.platform.db.implementation
import com.panomc.platform.annotation.Dao
import com.panomc.platform.db.dao.PanelConfigDao
import com.panomc.platform.db.model.PanelConfig
import io.vertx.kotlin.coroutines.await
import io.vertx.kotlin.coroutines.coAwait
import io.vertx.sqlclient.Row
import io.vertx.sqlclient.RowSet
import io.vertx.sqlclient.SqlClient
Expand All @@ -26,7 +26,7 @@ class PanelConfigDaoImpl : PanelConfigDao() {
"""
)
.execute()
.await()
.coAwait()
}

override suspend fun byUserIdAndOption(userId: Long, option: String, sqlClient: SqlClient): PanelConfig? {
Expand All @@ -36,7 +36,7 @@ class PanelConfigDaoImpl : PanelConfigDao() {
val rows: RowSet<Row> = sqlClient
.preparedQuery(query)
.execute(Tuple.of(userId, option))
.await()
.coAwait()

if (rows.size() == 0) {
return null
Expand All @@ -59,7 +59,7 @@ class PanelConfigDaoImpl : PanelConfigDao() {
panelConfig.value
)
)
.await()
.coAwait()
}

override suspend fun updateValueById(id: Long, value: String, sqlClient: SqlClient) {
Expand All @@ -74,7 +74,7 @@ class PanelConfigDaoImpl : PanelConfigDao() {
id
)
)
.await()
.coAwait()
}

override suspend fun deleteByUserId(userId: Long, sqlClient: SqlClient) {
Expand All @@ -87,6 +87,6 @@ class PanelConfigDaoImpl : PanelConfigDao() {
userId
)
)
.await()
.coAwait()
}
}
Loading

0 comments on commit 8b65160

Please sign in to comment.