Class PooledClientSqlClient

java.lang.Object
io.inverno.mod.sql.vertx.internal.AbstractSqlOperations
io.inverno.mod.sql.vertx.internal.AbstractSqlClient
io.inverno.mod.sql.vertx.PooledClientSqlClient
All Implemented Interfaces:
SqlClient, SqlOperations, UnsafeSqlOperations

public class PooledClientSqlClient extends io.inverno.mod.sql.vertx.internal.AbstractSqlClient

A Vert.x pooled client SQL client wrapper.

This SQL client implementation supports operations pipelining but does not support transaction.

Since:
1.2
Author:
Jeremy Kuhn
  • Constructor Details

    • PooledClientSqlClient

      public PooledClientSqlClient(io.vertx.sqlclient.SqlClient client)

      Creates a SQL client wrapper with the specified Vert.x pooled client.

      Parameters:
      client - a Vert.x pooled client
  • Method Details

    • transaction

      public Mono<TransactionalSqlOperations> transaction()
      Description copied from interface: SqlClient

      Returns transactional SQL operations exposing commit() and rollback() method when the implementation supports it.

      This method should be used when there is a need for explicit transaction management.

      The transaction MUST be explicitly committed or rolled back in order to free resources.

      Returns:
      a Mono emitting a transactional SQL operations object
    • transaction

      public <T> Publisher<T> transaction(Function<SqlOperations,Publisher<T>> function)
      Description copied from interface: SqlClient

      Executes the specified function within a transaction.

      All SQL operations performed within the function using the SQL operations argument will be executed within a transaction.

      The transaction is created when the returned publisher is subscribed and committed when the publisher returned by the function returned successfully, it is rolled back otherwise (error or cancel).

      Type Parameters:
      T - The type of results
      Parameters:
      function - the transactional function to be run in a transaction
      Returns:
      a publisher of result
    • connection

      public <T> Publisher<T> connection(Function<SqlOperations,Publisher<T>> function)
      Description copied from interface: SqlClient

      Executes the specified function within a single connection.

      All SQL operations performed within the function using the SQL operations argument will be executed using the same connection.

      The connection is obtained when the returned publisher is subscribed and closed when it terminates (complete, error or cancel).

      Whether connections are reused (pool) or created is implementation specific.

      Type Parameters:
      T - The type of results
      Parameters:
      function - the function to be run using a single connection
      Returns:
      a publisher