Package io.vertx.rxjava.pgclient

## Class PgConnection

- java.lang.Object
- - io.vertx.rxjava.sqlclient.SqlClient
  - - io.vertx.rxjava.sqlclient.SqlConnection
    - - io.vertx.rxjava.pgclient.PgConnection

-     public class PgConnection
      extends SqlConnection

  A connection to Postgres.

  The connection object supports all the operations defined in the interface, it also provides additional support:

  - Notification
  - Request Cancellation

  NOTE: This class has been automatically generated from the `original` non RX-ified interface using Vert.x codegen.

- - ### Field Summary

    Fields
    Modifier and Type | Field | Description
    --- | --- | ---
    `static io.vertx.lang.rx.TypeArg<PgConnection>` | `__TYPE_ARG` |

  - ### Constructor Summary

    Constructors
    Constructor | Description
    --- | ---
    `PgConnection​(PgConnection delegate)` |
    `PgConnection​(Object delegate)` |

  - ### Method Summary

    All Methods Static Methods Instance Methods Concrete Methods
    Modifier and Type | Method | Description
    --- | --- | ---
    `Future<Void>` | `cancelRequest()` | Send a request cancellation message to tell the server to cancel processing request in this connection.
    `static PgConnection` | `cast​(SqlConnection sqlConnection)` | Cast a to `PgConnection`.
    `PgConnection` | `closeHandler​(Handler<Void> handler)` | Set an handler called when the connection is closed.
    `static Future<PgConnection>` | `connect​(Vertx vertx)` | Like `connect(io.vertx.rxjava.core.Vertx, io.vertx.pgclient.PgConnectOptions)` with options build from the environment variables.
    `static Future<PgConnection>` | `connect​(Vertx vertx, PgConnectOptions options)` | Connects to the database and returns the connection if that succeeds.
    `static Future<PgConnection>` | `connect​(Vertx vertx, String connectionUri)` | Like `connect(io.vertx.rxjava.core.Vertx, io.vertx.pgclient.PgConnectOptions)` with options build from `connectionUri`.
    `boolean` | `equals​(Object o)` |
    `PgConnection` | `exceptionHandler​(Handler<Throwable> handler)` | Set an handler called with connection errors.
    `PgConnection` | `getDelegate()` |
    `int` | `hashCode()` |
    `static PgConnection` | `newInstance​(PgConnection arg)` |
    `PgConnection` | `noticeHandler​(Handler<PgNotice> handler)` | Set a handler called when the connection receives a notice from the server.
    `PgConnection` | `notificationHandler​(Handler<PgNotification> handler)` | Set a handler called when the connection receives notification on a channel.
    `int` | `processId()` |
    `Single<Void>` | `rxCancelRequest()` | Send a request cancellation message to tell the server to cancel processing request in this connection.
    `static Single<PgConnection>` | `rxConnect​(Vertx vertx)` | Like `connect(io.vertx.rxjava.core.Vertx, io.vertx.pgclient.PgConnectOptions)` with options build from the environment variables.
    `static Single<PgConnection>` | `rxConnect​(Vertx vertx, PgConnectOptions options)` | Connects to the database and returns the connection if that succeeds.
    `static Single<PgConnection>` | `rxConnect​(Vertx vertx, String connectionUri)` | Like `connect(io.vertx.rxjava.core.Vertx, io.vertx.pgclient.PgConnectOptions)` with options build from `connectionUri`.
    `int` | `secretKey()` |
    `String` | `toString()` |

    - ### Methods inherited from class io.vertx.rxjava.sqlclient.SqlConnection

      `begin, databaseMetadata, isSSL, newInstance, prepare, prepare, rxBegin, rxPrepare, rxPrepare, transaction`

    - ### Methods inherited from class io.vertx.rxjava.sqlclient.SqlClient

      `close, newInstance, preparedQuery, preparedQuery, query, rxClose`

    - ### Methods inherited from class java.lang.Object

      `clone, finalize, getClass, notify, notifyAll, wait, wait, wait`

- - ### Field Detail

    - #### __TYPE_ARG

          public static final io.vertx.lang.rx.TypeArg<PgConnection> __TYPE_ARG

  - ### Constructor Detail

    - #### PgConnection

          public PgConnection​(PgConnection delegate)

    - #### PgConnection

          public PgConnection​(Object delegate)

  - ### Method Detail

    - #### toString

          public String toString()

      Overrides:
        `toString` in class `SqlConnection`

    - #### equals

          public boolean equals​(Object o)

      Overrides:
        `equals` in class `SqlConnection`

    - #### hashCode

          public int hashCode()

      Overrides:
        `hashCode` in class `SqlConnection`

    - #### getDelegate

          public PgConnection getDelegate()

      Overrides:
        `getDelegate` in class `SqlConnection`

    - #### connect

          public static Future<PgConnection> connect​(Vertx vertx,
                                                     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.
      Parameters:
        `vertx` - the vertx instance
        `options` - the connect options
      Returns:
        a future notified with the connection or the failure

    - #### rxConnect

          public static Single<PgConnection> rxConnect​(Vertx vertx,
                                                       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.
      Parameters:
        `vertx` - the vertx instance
        `options` - the connect options
      Returns:
        a future notified with the connection or the failure

    - #### connect

          public static Future<PgConnection> connect​(Vertx vertx)

      Like `connect(io.vertx.rxjava.core.Vertx, io.vertx.pgclient.PgConnectOptions)` with options build from the environment variables.
      Parameters:
        `vertx` -
      Returns:

    - #### rxConnect

          public static Single<PgConnection> rxConnect​(Vertx vertx)

      Like `connect(io.vertx.rxjava.core.Vertx, io.vertx.pgclient.PgConnectOptions)` with options build from the environment variables.
      Parameters:
        `vertx` -
      Returns:

    - #### connect

          public static Future<PgConnection> connect​(Vertx vertx,
                                                     String connectionUri)

      Like `connect(io.vertx.rxjava.core.Vertx, io.vertx.pgclient.PgConnectOptions)` with options build from `connectionUri`.
      Parameters:
        `vertx` -
        `connectionUri` -
      Returns:

    - #### rxConnect

          public static Single<PgConnection> rxConnect​(Vertx vertx,
                                                       String connectionUri)

      Like `connect(io.vertx.rxjava.core.Vertx, io.vertx.pgclient.PgConnectOptions)` with options build from `connectionUri`.
      Parameters:
        `vertx` -
        `connectionUri` -
      Returns:

    - #### notificationHandler

          public PgConnection notificationHandler​(Handler<PgNotification> handler)

      Set a handler called when the connection receives notification on a channel.

      The handler is called with the `PgNotification` and has access to the channel name and the notification payload.
      Parameters:
        `handler` - the handler
      Returns:
        the transaction instance

    - #### noticeHandler

          public PgConnection noticeHandler​(Handler<PgNotice> handler)

      Set a handler called when the connection receives a notice from the server.
      Parameters:
        `handler` -
      Returns:

    - #### cancelRequest

          public Future<Void> 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.
      Returns:
        a future notified if cancelling request is sent

    - #### rxCancelRequest

          public Single<Void> rxCancelRequest()

      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.
      Returns:
        a future notified if cancelling request is sent

    - #### 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

          public PgConnection exceptionHandler​(Handler<Throwable> handler)

      Description copied from class: `SqlConnection`
      Set an handler called with connection errors.
      Overrides:
        `exceptionHandler` in class `SqlConnection`
      Parameters:
        `handler` -
      Returns:

    - #### closeHandler

          public PgConnection closeHandler​(Handler<Void> handler)

      Description copied from class: `SqlConnection`
      Set an handler called when the connection is closed.
      Overrides:
        `closeHandler` in class `SqlConnection`
      Parameters:
        `handler` -
      Returns:

    - #### cast

          public static PgConnection cast​(SqlConnection sqlConnection)

      Cast a to `PgConnection`. This is mostly useful for Vert.x generated APIs like RxJava/Mutiny.
      Parameters:
        `sqlConnection` - the connection to cast
      Returns:
        a `instance`

    - #### newInstance

          public static PgConnection newInstance​(PgConnection arg)