Class PgConnection
- All Implemented Interfaces:
MutinyDelegate
The connection object supports all the operations defined in the interface, it also provides additional support:
- Notification
- Request Cancellation
original non Mutiny-ified interface using Vert.x codegen.-
Field Summary
Fields -
Constructor Summary
ConstructorsConstructorDescriptionPgConnection(io.vertx.pgclient.PgConnection delegate) PgConnection(Object delegate) -
Method Summary
Modifier and TypeMethodDescriptionio.smallrye.mutiny.Uni<Void>Send a request cancellation message to tell the server to cancel processing request in this connection.Blocking variant ofcancelRequest().voidVariant ofcancelRequest()that ignores the result of the operation.static PgConnectioncast(SqlConnection sqlConnection) closeHandler(Runnable handler) static io.smallrye.mutiny.Uni<PgConnection>Likeconnect(io.vertx.mutiny.core.Vertx, io.vertx.pgclient.PgConnectOptions)with options build from the environment variables.static io.smallrye.mutiny.Uni<PgConnection>Connects to the database and returns the connection if that succeeds.static io.smallrye.mutiny.Uni<PgConnection>Likeconnect(io.vertx.mutiny.core.Vertx, io.vertx.pgclient.PgConnectOptions)with options build fromconnectionUri.static PgConnectionconnectAndAwait(Vertx vertx) Blocking variant ofconnect(io.vertx.mutiny.core.Vertx).static PgConnectionconnectAndAwait(Vertx vertx, io.vertx.pgclient.PgConnectOptions options) Blocking variant ofconnect(io.vertx.mutiny.core.Vertx,PgConnectOptions).static PgConnectionconnectAndAwait(Vertx vertx, String connectionUri) Blocking variant ofconnect(io.vertx.mutiny.core.Vertx,String).static voidconnectAndForget(Vertx vertx) Variant ofconnect(io.vertx.mutiny.core.Vertx)that ignores the result of the operation.static voidconnectAndForget(Vertx vertx, io.vertx.pgclient.PgConnectOptions options) Variant ofconnect(io.vertx.mutiny.core.Vertx,PgConnectOptions)that ignores the result of the operation.static voidconnectAndForget(Vertx vertx, String connectionUri) Variant ofconnect(io.vertx.mutiny.core.Vertx,String)that ignores the result of the operation.booleanexceptionHandler(Consumer<Throwable> handler) io.vertx.pgclient.PgConnectioninthashCode()static PgConnectionnewInstance(io.vertx.pgclient.PgConnection arg) noticeHandler(Consumer<io.vertx.pgclient.PgNotice> handler) notificationHandler(Consumer<io.vertx.pgclient.PgNotification> handler) io.smallrye.mutiny.Uni<PreparedStatement>Unlike the bare Vert.x variant, this method returns aUni.prepareAndAwait(String sql) Blocking variant ofprepare(String).prepareAndForget(String sql) Variant ofprepare(String)that ignores the result of the operation.intinttoString()Methods inherited from class io.vertx.mutiny.sqlclient.SqlConnection
begin, beginAndAwait, beginAndForget, close, closeAndAwait, closeAndForget, databaseMetadata, isSSL, newInstance, prepare, prepareAndAwait, prepareAndForget, transactionMethods inherited from class io.vertx.mutiny.sqlclient.SqlClient
newInstance, preparedQuery, preparedQuery, query
-
Field Details
-
__TYPE_ARG
-
-
Constructor Details
-
PgConnection
public PgConnection(io.vertx.pgclient.PgConnection delegate) -
PgConnection
-
-
Method Details
-
getDelegate
public io.vertx.pgclient.PgConnection getDelegate()- Specified by:
getDelegatein interfaceMutinyDelegate- Overrides:
getDelegatein classSqlConnection- Returns:
- the delegate used by this Mutiny object of generated type
-
toString
- Overrides:
toStringin classSqlConnection
-
equals
- Overrides:
equalsin classSqlConnection
-
hashCode
public int hashCode()- Overrides:
hashCodein classSqlConnection
-
connect
@CheckReturnValue public static io.smallrye.mutiny.Uni<PgConnection> connect(Vertx vertx, io.vertx.pgclient.PgConnectOptions options) Connects to the database and returns the connection if that succeeds. The connection interracts directly with the database is not a proxy, so closing the connection will close the underlying connection to the database.Unlike the bare Vert.x variant, this method returns a
Uni. Don't forget to subscribe on it to trigger the operation.- Parameters:
vertx- the vertx instanceoptions- the connect options- Returns:
- the
unifiring the result of the operation when completed, or a failure if the operation failed.
-
connectAndAwait
Blocking variant ofconnect(io.vertx.mutiny.core.Vertx,PgConnectOptions).This method waits for the completion of the underlying asynchronous operation. If the operation completes successfully, the result is returned, otherwise the failure is thrown (potentially wrapped in a RuntimeException).
- Parameters:
vertx- the vertx instanceoptions- the connect options- Returns:
- the PgConnection instance produced by the operation.
-
connectAndForget
Variant ofconnect(io.vertx.mutiny.core.Vertx,PgConnectOptions)that ignores the result of the operation.This method subscribes on the result of
connect(io.vertx.mutiny.core.Vertx,PgConnectOptions), but discards the outcome (item or failure). This method is useful to trigger the asynchronous operation fromconnect(io.vertx.mutiny.core.Vertx,PgConnectOptions)but you don't need to compose it with other operations.- Parameters:
vertx- the vertx instanceoptions- the connect options
-
connect
Likeconnect(io.vertx.mutiny.core.Vertx, io.vertx.pgclient.PgConnectOptions)with options build from the environment variables.Unlike the bare Vert.x variant, this method returns a
Uni. Don't forget to subscribe on it to trigger the operation.- Parameters:
vertx-- Returns:
- the
unifiring the result of the operation when completed, or a failure if the operation failed.
-
connectAndAwait
Blocking variant ofconnect(io.vertx.mutiny.core.Vertx).This method waits for the completion of the underlying asynchronous operation. If the operation completes successfully, the result is returned, otherwise the failure is thrown (potentially wrapped in a RuntimeException).
- Parameters:
vertx-- Returns:
- the PgConnection instance produced by the operation.
-
connectAndForget
Variant ofconnect(io.vertx.mutiny.core.Vertx)that ignores the result of the operation.This method subscribes on the result of
connect(io.vertx.mutiny.core.Vertx), but discards the outcome (item or failure). This method is useful to trigger the asynchronous operation fromconnect(io.vertx.mutiny.core.Vertx)but you don't need to compose it with other operations.- Parameters:
vertx-
-
connect
@CheckReturnValue public static io.smallrye.mutiny.Uni<PgConnection> connect(Vertx vertx, String connectionUri) Likeconnect(io.vertx.mutiny.core.Vertx, io.vertx.pgclient.PgConnectOptions)with options build fromconnectionUri.Unlike the bare Vert.x variant, this method returns a
Uni. Don't forget to subscribe on it to trigger the operation.- Parameters:
vertx-connectionUri-- Returns:
- the
unifiring the result of the operation when completed, or a failure if the operation failed.
-
connectAndAwait
Blocking variant ofconnect(io.vertx.mutiny.core.Vertx,String).This method waits for the completion of the underlying asynchronous operation. If the operation completes successfully, the result is returned, otherwise the failure is thrown (potentially wrapped in a RuntimeException).
- Parameters:
vertx-connectionUri-- Returns:
- the PgConnection instance produced by the operation.
-
connectAndForget
Variant ofconnect(io.vertx.mutiny.core.Vertx,String)that ignores the result of the operation.This method subscribes on the result of
connect(io.vertx.mutiny.core.Vertx,String), but discards the outcome (item or failure). This method is useful to trigger the asynchronous operation fromconnect(io.vertx.mutiny.core.Vertx,String)but you don't need to compose it with other operations.- Parameters:
vertx-connectionUri-
-
notificationHandler
- Parameters:
handler- the handler- Returns:
-
noticeHandler
- Parameters:
handler-- Returns:
-
cancelRequest
Send a request cancellation message to tell the server to cancel processing request in this connection.
Note: Use this with caution because the cancellation signal may or may not have any effect.Unlike the bare Vert.x variant, this method returns a
Uni. Don't forget to subscribe on it to trigger the operation.- Returns:
- the
unifiring the result of the operation when completed, or a failure if the operation failed.
-
cancelRequestAndAwait
Blocking variant ofcancelRequest().This method waits for the completion of the underlying asynchronous operation. If the operation completes successfully, the result is returned, otherwise the failure is thrown (potentially wrapped in a RuntimeException).
- Returns:
- the Void instance produced by the operation.
-
cancelRequestAndForget
public void cancelRequestAndForget()Variant ofcancelRequest()that ignores the result of the operation.This method subscribes on the result of
cancelRequest(), but discards the outcome (item or failure). This method is useful to trigger the asynchronous operation fromcancelRequest()but you don't need to compose it with other operations. -
processId
public int processId()- Returns:
- The process ID of the target backend
-
secretKey
public int secretKey()- Returns:
- The secret key for the target backend
-
prepare
Unlike the bare Vert.x variant, this method returns a
Uni. Don't forget to subscribe on it to trigger the operation.- Overrides:
preparein classSqlConnection- Parameters:
sql-- Returns:
- the
unifiring the result of the operation when completed, or a failure if the operation failed.
-
prepareAndAwait
Blocking variant ofprepare(String).This method waits for the completion of the underlying asynchronous operation. If the operation completes successfully, the result is returned, otherwise the failure is thrown (potentially wrapped in a RuntimeException).
- Overrides:
prepareAndAwaitin classSqlConnection- Parameters:
sql-- Returns:
- the PreparedStatement instance produced by the operation.
-
prepareAndForget
Variant ofprepare(String)that ignores the result of the operation.This method subscribes on the result of
prepare(String), but discards the outcome (item or failure). This method is useful to trigger the asynchronous operation fromprepare(String)but you don't need to compose it with other operations.- Overrides:
prepareAndForgetin classSqlConnection- Parameters:
sql-- Returns:
- the instance of PgConnection to chain method calls.
-
exceptionHandler
- Overrides:
exceptionHandlerin classSqlConnection- Parameters:
handler-- Returns:
-
closeHandler
- Overrides:
closeHandlerin classSqlConnection- Parameters:
handler-- Returns:
-
cast
- Parameters:
sqlConnection- the connection to cast- Returns:
- a
instance
-
newInstance
-