Skip to content

Commit

Permalink
Run Code Cleanup with IntelliJ IDEA and revert some erroneous or unne…
Browse files Browse the repository at this point in the history
…cessary changes
  • Loading branch information
ShreckYe committed Nov 14, 2024
1 parent ed81cd8 commit 33f0abd
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 9 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ import org.jetbrains.exposed.sql.transactions.transaction
class PreparedSqlGenerationBenchmark : WithContainerizedDatabaseBenchmark() {
enum class StatementEnum(val statement: Statement<*>) {
SelectAll(VarcharTable.selectAll()),
SelectWhere(VarcharTable.select(VarcharTable.id eq 0L)),
SelectWhere(VarcharTable.selectAll().where(VarcharTable.id eq 0L)),
Insert(VarcharTable.insertStatement { it[varcharColumn] = "string" }),
Update(VarcharTable.updateStatement({ VarcharTable.id eq 0L }) {
it[varcharColumn] = "string"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import com.huanshankeji.collections.singleOrNullIfEmpty
import com.huanshankeji.exposedvertxsqlclient.ConnectionConfig.Socket
import com.huanshankeji.exposedvertxsqlclient.ConnectionConfig.UnixDomainSocketWithPeerAuthentication
import com.huanshankeji.exposedvertxsqlclient.sql.selectExpression
import com.huanshankeji.os.isOSLinux
import com.huanshankeji.os.isCurrentOsLinux
import com.huanshankeji.vertx.kotlin.coroutines.coroutineToFuture
import com.huanshankeji.vertx.kotlin.sqlclient.executeBatchAwaitForSqlResultSequence
import io.vertx.core.Vertx
Expand Down Expand Up @@ -529,7 +529,7 @@ fun createBetterPgPoolDatabaseClient(
) =
createPgPoolDatabaseClient(
vertx,
if (isOSLinux()) ConnectionType.UnixDomainSocketWithPeerAuthentication else ConnectionType.Socket,
if (isCurrentOsLinux()) ConnectionType.UnixDomainSocketWithPeerAuthentication else ConnectionType.Socket,
localConnectionConfig,
extraPgConnectOptions, poolOptions,
exposedDatabase
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ package com.huanshankeji.exposedvertxsqlclient

import com.huanshankeji.Untested
import io.vertx.core.Vertx
import io.vertx.kotlin.coroutines.await
import io.vertx.kotlin.coroutines.coAwait
import io.vertx.kotlin.sqlclient.poolOptionsOf
import io.vertx.pgclient.PgConnectOptions
import io.vertx.pgclient.PgConnection
Expand Down Expand Up @@ -34,7 +34,7 @@ private val pgConnectionConnect: suspend (Vertx?, PgConnectOptions, Nothing?) ->
*/

suspend fun SqlConnection.executeSetRole(role: String) =
query("SET ROLE $role").execute().await()
query("SET ROLE $role").execute().coAwait()

// TODO: use `ConnectionConfig` as the argument directly in all the following functions

Expand Down Expand Up @@ -82,7 +82,7 @@ suspend fun createSocketPgConnection(
createSocketGenericPgClient(
vertx, host, port, database, user, password, extraPgConnectOptions, null
) { vertx, pgConnectOptions, _ ->
PgConnection.connect(vertx, pgConnectOptions).await()
PgConnection.connect(vertx, pgConnectOptions).coAwait()
}


Expand Down Expand Up @@ -121,7 +121,7 @@ suspend fun createUnixDomainSocketPgSqlClientAndSetRole(
vertx, host, database, extraPgConnectOptions, poolOptions
).apply {
// Is this done for all connections?
query("SET ROLE $role").execute().await()
query("SET ROLE $role").execute().coAwait()
}

fun createPeerAuthenticationUnixDomainSocketPgPool(
Expand All @@ -144,7 +144,7 @@ fun createPeerAuthenticationUnixDomainSocketPgPoolAndSetRole(
// TODO: are exceptions handled?
it.executeSetRole(role)
/** @see Pool.connectHandler */
it.close().await()
it.close().coAwait()
}
}

Expand All @@ -157,7 +157,7 @@ suspend fun createPeerAuthenticationUnixDomainSocketPgConnectionAndSetRole(
createPeerAuthenticationUnixDomainSocketGenericPgClient(
vertx, host, database, extraPgConnectOptions, null
) { vertx, pgConnectOptions, _ ->
PgConnection.connect(vertx, pgConnectOptions).await().apply {
PgConnection.connect(vertx, pgConnectOptions).coAwait().apply {
executeSetRole(role)
}
}

0 comments on commit 33f0abd

Please sign in to comment.