io.vertx.pgclient

## Interface PgPool

- All Superinterfaces:
    Pool, SqlClient

      public interface PgPool
      extends Pool

  A `pool` of `PostgreSQL connections`.
  Author:
    Julien Viet

- - ### Method Summary

    All Methods Static Methods Instance Methods Abstract Methods Default Methods
    Modifier and Type | Method and Description
    --- | ---
    `static SqlClient` | `client()` Like `client(PoolOptions)` with default options.
    `static SqlClient` | `client(List<PgConnectOptions> databases, PoolOptions options)` Create a client backed by a connection pool to the PostgreSQL `databases` with round-robin selection.
    `static SqlClient` | `client(PgConnectOptions database, PoolOptions options)` Create a client backed by a connection pool to the PostgreSQL `database` configured with the given `options`.
    `static SqlClient` | `client(PoolOptions options)` Like `client(PgConnectOptions, PoolOptions)` with `database` retrieved from the environment variables.
    `static SqlClient` | `client(String connectionUri)` Like `pool(String, PoolOptions)` with default options.
    `static SqlClient` | `client(String connectionUri, PoolOptions options)` Like `client(PgConnectOptions, PoolOptions)` with `database` retrieved from the `connectionUri`.
    `static SqlClient` | `client(Vertx vertx, List<PgConnectOptions> databases, PoolOptions options)` Like `client(List, PoolOptions)` with a specific `Vertx` instance.
    `static SqlClient` | `client(Vertx vertx, PgConnectOptions database, PoolOptions options)` Like `client(PgConnectOptions, PoolOptions)` with a specific `Vertx` instance.
    `static SqlClient` | `client(Vertx vertx, PoolOptions poolOptions)` Like `client(Vertx, PgConnectOptions, PoolOptions)` with `database` retrieved from the environment variables.
    `static SqlClient` | `client(Vertx vertx, String connectionUri)` Like `client(Vertx, String,PoolOptions)` with default options.
    `static SqlClient` | `client(Vertx vertx, String connectionUri, PoolOptions options)` Like `client(Vertx, PgConnectOptions, PoolOptions)` with `database` build from `connectionUri`.
    `PgPool` | `connectHandler(Handler<SqlConnection> handler)` Set an handler called when the pool has established a connection to the database.
    `PgPool` | `connectionProvider(java.util.function.Function<Context,Future<SqlConnection>> provider)` Replace the default pool connection provider, the new `provider` returns a future connection for a given `Context`.
    `static PgPool` | `pool()` Like `pool(PoolOptions)` with a default `poolOptions`.
    `static PgPool` | `pool(List<PgConnectOptions> databases, PoolOptions poolOptions)` Create a connection pool to the PostgreSQL `databases` with round-robin selection.
    `static PgPool` | `pool(PgConnectOptions database, PoolOptions options)` Create a connection pool to the PostgreSQL `database` configured with the given `options`.
    `static PgPool` | `pool(PoolOptions options)` Like `pool(PgConnectOptions, PoolOptions)` with `connectOptions` build from the environment variables.
    `static PgPool` | `pool(String connectionUri)` Like `pool(String, PoolOptions)` with a default `poolOptions`.
    `static PgPool` | `pool(String connectionUri, PoolOptions options)` Like `pool(PgConnectOptions, PoolOptions)` with `connectOptions` build from `connectionUri`.
    `static PgPool` | `pool(Vertx vertx, List<PgConnectOptions> databases, PoolOptions poolOptions)` Like `pool(List, PoolOptions)` with a specific `Vertx` instance.
    `static PgPool` | `pool(Vertx vertx, PgConnectOptions database, PoolOptions options)` Like `pool(PgConnectOptions, PoolOptions)` with a specific `Vertx` instance.
    `static PgPool` | `pool(Vertx vertx, PoolOptions options)` Like `pool(Vertx, PgConnectOptions, PoolOptions)` with the `database` retrieved from the environment variables.
    `static PgPool` | `pool(Vertx vertx, String connectionUri)` Like `pool(Vertx, String,PoolOptions)` with default options.
    `static PgPool` | `pool(Vertx vertx, String connectionUri, PoolOptions poolOptions)` Like `pool(Vertx, PgConnectOptions, PoolOptions)` with `database` retrieved from the given `connectionUri`.

    - ### Methods inherited from interface io.vertx.sqlclient.Pool

      `close, getConnection, getConnection, pool, pool, pool, preparedQuery, query, size, withConnection, withConnection, withTransaction, withTransaction`

    - ### Methods inherited from interface io.vertx.sqlclient.SqlClient

      `close, preparedQuery`

- - ### Method Detail

    - #### pool

          static PgPool pool()

      Like `pool(PoolOptions)` with a default `poolOptions`.

    - #### pool

          static PgPool pool(PoolOptions options)

      Like `pool(PgConnectOptions, PoolOptions)` with `connectOptions` build from the environment variables.

    - #### pool

          static PgPool pool(String connectionUri)

      Like `pool(String, PoolOptions)` with a default `poolOptions`.

    - #### pool

          static PgPool pool(String connectionUri,
                             PoolOptions options)

      Like `pool(PgConnectOptions, PoolOptions)` with `connectOptions` build from `connectionUri`.

    - #### pool

          static PgPool pool(Vertx vertx,
                             String connectionUri)

      Like `pool(Vertx, String,PoolOptions)` with default options.

    - #### pool

          static PgPool pool(Vertx vertx,
                             PoolOptions options)

      Like `pool(Vertx, PgConnectOptions, PoolOptions)` with the `database` retrieved from the environment variables.

    - #### pool

          static PgPool pool(Vertx vertx,
                             String connectionUri,
                             PoolOptions poolOptions)

      Like `pool(Vertx, PgConnectOptions, PoolOptions)` with `database` retrieved from the given `connectionUri`.

    - #### pool

          static PgPool pool(PgConnectOptions database,
                             PoolOptions options)

      Create a connection pool to the PostgreSQL `database` configured with the given `options`.
      Parameters:
        `database` - the database
        `options` - the options for creating the pool
      Returns:
        the connection pool

    - #### pool

          static PgPool pool(Vertx vertx,
                             PgConnectOptions database,
                             PoolOptions options)

      Like `pool(PgConnectOptions, PoolOptions)` with a specific `Vertx` instance.

    - #### pool

          static PgPool pool(List<PgConnectOptions> databases,
                             PoolOptions poolOptions)

      Create a connection pool to the PostgreSQL `databases` with round-robin selection. Round-robin is applied when a new connection is created by the pool.
      Parameters:
        `databases` - the list of databases
        `poolOptions` - the options for creating the pool
      Returns:
        the connection pool

    - #### pool

          static PgPool pool(Vertx vertx,
                             List<PgConnectOptions> databases,
                             PoolOptions poolOptions)

      Like `pool(List, PoolOptions)` with a specific `Vertx` instance.

    - #### client

          static SqlClient client()

      Like `client(PoolOptions)` with default options.

    - #### client

          static SqlClient client(PoolOptions options)

      Like `client(PgConnectOptions, PoolOptions)` with `database` retrieved from the environment variables.

    - #### client

          static SqlClient client(String connectionUri)

      Like `pool(String, PoolOptions)` with default options.

    - #### client

          static SqlClient client(String connectionUri,
                                  PoolOptions options)

      Like `client(PgConnectOptions, PoolOptions)` with `database` retrieved from the `connectionUri`.

    - #### client

          static SqlClient client(Vertx vertx,
                                  String connectionUri)

      Like `client(Vertx, String,PoolOptions)` with default options.

    - #### client

          static SqlClient client(Vertx vertx,
                                  PoolOptions poolOptions)

      Like `client(Vertx, PgConnectOptions, PoolOptions)` with `database` retrieved from the environment variables.

    - #### client

          static SqlClient client(Vertx vertx,
                                  String connectionUri,
                                  PoolOptions options)

      Like `client(Vertx, PgConnectOptions, PoolOptions)` with `database` build from `connectionUri`.

    - #### client

          static SqlClient client(PgConnectOptions database,
                                  PoolOptions options)

      Create a client backed by a connection pool to the PostgreSQL `database` configured with the given `options`.
      Parameters:
        `options` - the options for creating the backing pool
      Returns:
        the pooled client

    - #### client

          static SqlClient client(Vertx vertx,
                                  PgConnectOptions database,
                                  PoolOptions options)

      Like `client(PgConnectOptions, PoolOptions)` with a specific `Vertx` instance.

    - #### client

          static SqlClient client(Vertx vertx,
                                  List<PgConnectOptions> databases,
                                  PoolOptions options)

      Like `client(List, PoolOptions)` with a specific `Vertx` instance.

    - #### client

          static SqlClient client(List<PgConnectOptions> databases,
                                  PoolOptions options)

      Create a client backed by a connection pool to the PostgreSQL `databases` with round-robin selection. Round-robin is applied when a new connection is created by the pool.
      Parameters:
        `databases` - the list of databases
        `options` - the options for creating the pool
      Returns:
        the pooled client

    - #### connectHandler

          PgPool connectHandler(Handler<SqlConnection> handler)

      Description copied from interface: `Pool`
      Set an handler called when the pool has established a connection to the database.

      This handler allows interactions with the database before the connection is added to the pool.

      When the handler has finished, it must call `SqlClient.close()` to release the connection to the pool.

      Specified by:
        `connectHandler` in interface `Pool`
      Parameters:
        `handler` - the handler
      Returns:
        a reference to this, so the API can be used fluently

    - #### connectionProvider

          PgPool connectionProvider(java.util.function.Function<Context,Future<SqlConnection>> provider)

      Description copied from interface: `Pool`
      Replace the default pool connection provider, the new `provider` returns a future connection for a given `Context`.

      A `ConnectionFactory` can be used as connection provider.

      Specified by:
        `connectionProvider` in interface `Pool`
      Parameters:
        `provider` - the new connection provider
      Returns:
        a reference to this, so the API can be used fluently

Copyright © 2022 Eclipse. All rights reserved.