Class PgConnection
- All Implemented Interfaces:
MutinyDelegate
The connection object supports all the operations defined in the SqlConnection interface,
it also provides additional support:
- Notification
- Request Cancellation
NOTE: This class has been automatically generated from the original non Mutiny-ified interface.
- Author:
- Julien Viet, Emad Alblueshi
- See Also:
-
PgConnection
-
Field Summary
Fields -
Constructor Summary
ConstructorsConstructorDescriptionPgConnection(io.vertx.pgclient.PgConnection delegate) Create a new instance ofPgConnectiondelegating to the given (non-null) instance ofPgConnection.PgConnection(Object delegate) -
Method Summary
Modifier and TypeMethodDescriptionio.smallrye.mutiny.Uni<Transaction>begin()Begin a transaction and returns aTransactionfor controlling and tracking this transaction.Begin a transaction and returns aTransactionfor controlling and tracking this transaction.Begin a transaction and returns aTransactionfor controlling and tracking this transaction.io.smallrye.mutiny.Uni<Void>Send a request cancellation message to tell the server to cancel processing request in this connection.voidSend a request cancellation message to tell the server to cancel processing request in this connection.Send a request cancellation message to tell the server to cancel processing request in this connection.static PgConnectioncast(SqlConnection sqlConnection) Cast aSqlConnectiontoPgConnection.io.smallrye.mutiny.Uni<Void>close()Close the client and release the associated resources.voidClose the client and release the associated resources.Close the client and release the associated resources.closeHandler(Runnable handler) Set an handler called when the connection is closed.static io.smallrye.mutiny.Uni<PgConnection>Likeconnect(Vertx, 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(Vertx, PgConnectOptions)with options build fromconnectionUri.static PgConnectionconnectAndAwait(Vertx vertx) Likeconnect(Vertx, PgConnectOptions)with options build from the environment variables.static PgConnectionconnectAndAwait(Vertx vertx, io.vertx.pgclient.PgConnectOptions options) Connects to the database and returns the connection if that succeeds.static PgConnectionconnectAndAwait(Vertx vertx, String connectionUri) Likeconnect(Vertx, PgConnectOptions)with options build fromconnectionUri.static voidconnectAndForget(Vertx vertx) Likeconnect(Vertx, PgConnectOptions)with options build from the environment variables.static voidconnectAndForget(Vertx vertx, io.vertx.pgclient.PgConnectOptions options) Connects to the database and returns the connection if that succeeds.static voidconnectAndForget(Vertx vertx, String connectionUri) Likeconnect(Vertx, PgConnectOptions)with options build fromconnectionUri.booleanexceptionHandler(Consumer<Throwable> handler) Set an handler called with connection errors.io.vertx.pgclient.PgConnectionGet the delegate instance.inthashCode()static PgConnectionnewInstance(io.vertx.pgclient.PgConnection delegate) Creates a new instance of thePgConnection.noticeHandler(Consumer<io.vertx.pgclient.PgNotice> handler) Set a handler called when the connection receives a notice from the server.notificationHandler(Consumer<io.vertx.pgclient.PgNotification> handler) Set a handler called when the connection receives notification on a channel.io.smallrye.mutiny.Uni<PreparedStatement>Create a prepared statement using the givensqlstring.io.smallrye.mutiny.Uni<PreparedStatement>Create a prepared statement using the givensqlstring.prepareAndAwait(String sql) Create a prepared statement using the givensqlstring.prepareAndAwait(String sql, io.vertx.sqlclient.PrepareOptions options) Create a prepared statement using the givensqlstring.prepareAndForget(String sql) Create a prepared statement using the givensqlstring.prepareAndForget(String sql, io.vertx.sqlclient.PrepareOptions options) Create a prepared statement using the givensqlstring.intinttoString()Methods inherited from class io.vertx.mutiny.sqlclient.SqlConnection
databaseMetadata, isSSL, newInstance, 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) Create a new instance ofPgConnectiondelegating to the given (non-null) instance ofPgConnection. -
PgConnection
-
-
Method Details
-
getDelegate
public io.vertx.pgclient.PgConnection getDelegate()Get the delegate instance.This method returns the instance on which this shim is delegating the calls. And so, give you access to the bare API.
- Specified by:
getDelegatein interfaceMutinyDelegate- Overrides:
getDelegatein classSqlConnection- Returns:
- the delegate instance
-
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. The uni emits the result of the operation as item. If the operation fails, the uni emits the failure.Don't forget to subscribe on it to trigger the operation.
- Parameters:
vertx- the vertx instanceoptions- the connect options- Returns:
- A
Unirepresenting the asynchronous result of this operation. - See Also:
-
io.vertx.pgclient.PgConnection#connect(Vertx, PgConnectOptions)
-
connectAndAwait
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
PgConnection. This method awaits indefinitely 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 aRuntimeException).- Parameters:
vertx- the vertx instanceoptions- the connect options- Returns:
- The operation result
- See Also:
-
io.vertx.pgclient.PgConnection#connect(Vertx, PgConnectOptions)
-
connectAndForget
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 ignores the
PgConnectionresult or any failure.- Parameters:
vertx- the vertx instanceoptions- the connect options- See Also:
-
io.vertx.pgclient.PgConnection#connect(Vertx, PgConnectOptions)
-
connect
Likeconnect(Vertx, PgConnectOptions)with options build from the environment variables.Unlike the bare Vert.x variant, this method returns a
Uni. The uni emits the result of the operation as item. If the operation fails, the uni emits the failure.Don't forget to subscribe on it to trigger the operation.
- Returns:
- A
Unirepresenting the asynchronous result of this operation. - See Also:
-
io.vertx.pgclient.PgConnection#connect(Vertx)
-
connectAndAwait
Likeconnect(Vertx, PgConnectOptions)with options build from the environment variables.Unlike the bare Vert.x variant, this method returns a
PgConnection. This method awaits indefinitely 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 aRuntimeException).- Returns:
- The operation result
- See Also:
-
io.vertx.pgclient.PgConnection#connect(Vertx)
-
connectAndForget
Likeconnect(Vertx, PgConnectOptions)with options build from the environment variables.Unlike the bare Vert.x variant, this method ignores the
PgConnectionresult or any failure.- See Also:
-
io.vertx.pgclient.PgConnection#connect(Vertx)
-
connect
@CheckReturnValue public static io.smallrye.mutiny.Uni<PgConnection> connect(Vertx vertx, String connectionUri) Likeconnect(Vertx, PgConnectOptions)with options build fromconnectionUri.Unlike the bare Vert.x variant, this method returns a
Uni. The uni emits the result of the operation as item. If the operation fails, the uni emits the failure.Don't forget to subscribe on it to trigger the operation.
- Returns:
- A
Unirepresenting the asynchronous result of this operation. - See Also:
-
io.vertx.pgclient.PgConnection#connect(Vertx, String)
-
connectAndAwait
Likeconnect(Vertx, PgConnectOptions)with options build fromconnectionUri.Unlike the bare Vert.x variant, this method returns a
PgConnection. This method awaits indefinitely 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 aRuntimeException).- Returns:
- The operation result
- See Also:
-
io.vertx.pgclient.PgConnection#connect(Vertx, String)
-
connectAndForget
Likeconnect(Vertx, PgConnectOptions)with options build fromconnectionUri.Unlike the bare Vert.x variant, this method ignores the
PgConnectionresult or any failure.- See Also:
-
io.vertx.pgclient.PgConnection#connect(Vertx, String)
-
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. The uni emits the result of the operation as item. If the operation fails, the uni emits the failure.Don't forget to subscribe on it to trigger the operation.
- Returns:
- A
Unirepresenting the asynchronous result of this operation. - See Also:
-
PgConnection.cancelRequest()
-
cancelRequestAndAwait
public void cancelRequestAndAwait()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
Void. This method awaits indefinitely 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 aRuntimeException).- See Also:
-
PgConnection.cancelRequest()
-
cancelRequestAndForget
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 ignores the
Voidresult or any failure.- Returns:
- The current instance to chain operations if needed.
- See Also:
-
PgConnection.cancelRequest()
-
prepare
Create a prepared statement using the givensqlstring.Unlike the bare Vert.x variant, this method returns a
Uni. The uni emits the result of the operation as item. If the operation fails, the uni emits the failure.Don't forget to subscribe on it to trigger the operation.
- Overrides:
preparein classSqlConnection- Parameters:
sql- the sql- Returns:
- A
Unirepresenting the asynchronous result of this operation. - See Also:
-
SqlConnection.prepare(String)
-
prepareAndAwait
Create a prepared statement using the givensqlstring.Unlike the bare Vert.x variant, this method returns a
PreparedStatement. This method awaits indefinitely 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 aRuntimeException).- Overrides:
prepareAndAwaitin classSqlConnection- Parameters:
sql- the sql- Returns:
- The operation result
- See Also:
-
SqlConnection.prepare(String)
-
prepareAndForget
Create a prepared statement using the givensqlstring.Unlike the bare Vert.x variant, this method ignores the
PreparedStatementresult or any failure.- Overrides:
prepareAndForgetin classSqlConnection- Parameters:
sql- the sql- Returns:
- The current instance to chain operations if needed.
- See Also:
-
SqlConnection.prepare(String)
-
close
Close the client and release the associated resources.Unlike the bare Vert.x variant, this method returns a
Uni. The uni emits the result of the operation as item. If the operation fails, the uni emits the failure.Don't forget to subscribe on it to trigger the operation.
- Overrides:
closein classSqlConnection- Returns:
- A
Unirepresenting the asynchronous result of this operation. - See Also:
-
SqlClient.close()
-
closeAndAwait
public void closeAndAwait()Close the client and release the associated resources.Unlike the bare Vert.x variant, this method returns a
Void. This method awaits indefinitely 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 aRuntimeException).- Overrides:
closeAndAwaitin classSqlConnection- See Also:
-
SqlClient.close()
-
closeAndForget
Close the client and release the associated resources.Unlike the bare Vert.x variant, this method ignores the
Voidresult or any failure.- Overrides:
closeAndForgetin classSqlConnection- Returns:
- The current instance to chain operations if needed.
- See Also:
-
SqlClient.close()
-
begin
Begin a transaction and returns aTransactionfor controlling and tracking this transaction. When the connection is explicitely closed, any inflight transaction is rollbacked.Unlike the bare Vert.x variant, this method returns a
Uni. The uni emits the result of the operation as item. If the operation fails, the uni emits the failure.Don't forget to subscribe on it to trigger the operation.
- Overrides:
beginin classSqlConnection- Returns:
- A
Unirepresenting the asynchronous result of this operation. - See Also:
-
SqlConnection.begin()
-
beginAndAwait
Begin a transaction and returns aTransactionfor controlling and tracking this transaction. When the connection is explicitely closed, any inflight transaction is rollbacked.Unlike the bare Vert.x variant, this method returns a
Transaction. This method awaits indefinitely 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 aRuntimeException).- Overrides:
beginAndAwaitin classSqlConnection- Returns:
- The operation result
- See Also:
-
SqlConnection.begin()
-
beginAndForget
Begin a transaction and returns aTransactionfor controlling and tracking this transaction. When the connection is explicitely closed, any inflight transaction is rollbacked.Unlike the bare Vert.x variant, this method ignores the
Transactionresult or any failure.- Overrides:
beginAndForgetin classSqlConnection- Returns:
- The current instance to chain operations if needed.
- See Also:
-
SqlConnection.begin()
-
prepare
@CheckReturnValue public io.smallrye.mutiny.Uni<PreparedStatement> prepare(String sql, io.vertx.sqlclient.PrepareOptions options) Create a prepared statement using the givensqlstring.Unlike the bare Vert.x variant, this method returns a
Uni. The uni emits the result of the operation as item. If the operation fails, the uni emits the failure.Don't forget to subscribe on it to trigger the operation.
- Overrides:
preparein classSqlConnection- Parameters:
sql- the sql- Returns:
- A
Unirepresenting the asynchronous result of this operation. - See Also:
-
SqlConnection.prepare(String, PrepareOptions)
-
prepareAndAwait
Create a prepared statement using the givensqlstring.Unlike the bare Vert.x variant, this method returns a
PreparedStatement. This method awaits indefinitely 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 aRuntimeException).- Overrides:
prepareAndAwaitin classSqlConnection- Parameters:
sql- the sql- Returns:
- The operation result
- See Also:
-
SqlConnection.prepare(String, PrepareOptions)
-
prepareAndForget
Create a prepared statement using the givensqlstring.Unlike the bare Vert.x variant, this method ignores the
PreparedStatementresult or any failure.- Overrides:
prepareAndForgetin classSqlConnection- Parameters:
sql- the sql- Returns:
- The current instance to chain operations if needed.
- See Also:
-
SqlConnection.prepare(String, PrepareOptions)
-
notificationHandler
Set a handler called when the connection receives notification on a channel. The handler is called with thePgNotificationand has access to the channel name and the notification payload.- Parameters:
handler- the handler- Returns:
- the transaction instance
-
noticeHandler
Set a handler called when the connection receives a notice from the server.- Parameters:
handler-- Returns:
-
processId
public int processId()- Returns:
- The process ID of the target backend
-
secretKey
public int secretKey()- Returns:
- The secret key for the target backend
-
exceptionHandler
Set an handler called with connection errors.- Overrides:
exceptionHandlerin classSqlConnection- Parameters:
handler- the handler- Returns:
- a reference to this, so the API can be used fluently
-
closeHandler
Set an handler called when the connection is closed.- Overrides:
closeHandlerin classSqlConnection- Parameters:
handler- the handler- Returns:
- a reference to this, so the API can be used fluently
-
cast
Cast aSqlConnectiontoPgConnection. This is mostly useful for Vert.x generated APIs like RxJava/Mutiny.- Parameters:
sqlConnection- the connection to cast- Returns:
- a
instance
-
newInstance
Creates a new instance of thePgConnection. -
hashCode
public int hashCode()- Overrides:
hashCodein classSqlConnection
-
equals
- Overrides:
equalsin classSqlConnection
-
toString
- Overrides:
toStringin classSqlConnection
-