io.vertx.reactivex.sqlclient.templates

## Class SqlTemplate<I,R>

- java.lang.Object
- - io.vertx.reactivex.sqlclient.templates.SqlTemplate<I,R>

-     public class SqlTemplate<I,R>
      extends Object

  An SQL template.

  SQL templates are useful for interacting with a relational database.

  SQL templates execute queries using named instead of positional parameters. Query execution is parameterized by a map of string to objects instead of a `Tuple`. The default source of parameters is a simple map, a user defined mapping can be used instead given it maps the source to such a map.

  SQL template default results are , a user defined mapping can be used instead, mapping the result set to a of the mapped type.

  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 and Description
    --- | ---
    `static io.vertx.lang.rx.TypeArg<SqlTemplate>` | `__TYPE_ARG`
    `io.vertx.lang.rx.TypeArg<I>` | `__typeArg_0`
    `io.vertx.lang.rx.TypeArg<R>` | `__typeArg_1`

  - ### Constructor Summary

    Constructors
    Constructor and Description
    `SqlTemplate(Object delegate, io.vertx.lang.rx.TypeArg<I> typeArg_0, io.vertx.lang.rx.TypeArg<R> typeArg_1)`
    `SqlTemplate(SqlTemplate delegate)`

  - ### Method Summary

    All Methods Static Methods Instance Methods Concrete Methods
    Modifier and Type | Method and Description
    --- | ---
    `boolean` | `equals(Object o)`
    `void` | `execute(I parameters)` Execute the query with the `parameters`
    `void` | `execute(I parameters, Handler<AsyncResult<R>> handler)` Execute the query with the `parameters`
    `void` | `executeBatch(List<I> batch)` Execute a batch query with the `batch`.
    `void` | `executeBatch(List<I> batch, Handler<AsyncResult<R>> handler)` Execute a batch query with the `batch`.
    `static SqlTemplate<Map<String,Object>,RowSet<Row>>` | `forQuery(SqlClient client, String template)` Create an SQL template for query purpose consuming map parameters and returning .
    `static SqlTemplate<Map<String,Object>,SqlResult<Void>>` | `forUpdate(SqlClient client, String template)` Create an SQL template for query purpose consuming map parameters and returning void.
    `SqlTemplate` | `getDelegate()`
    `int` | `hashCode()`
    `<T> SqlTemplate<T,R>` | `mapFrom(Class<T> type)` Set a parameters user defined class mapping.
    `<T> SqlTemplate<T,R>` | `mapFrom(TupleMapper<T> mapper)` Set a parameters user defined mapping function.
    `<U> SqlTemplate<I,RowSet<U>>` | `mapTo(Class<U> type)` Set a row user defined mapping function.
    `<U> SqlTemplate<I,RowSet<U>>` | `mapTo(RowMapper<U> mapper)` Set a row user defined mapping function.
    `static <I,R> SqlTemplate<I,R>` | `newInstance(SqlTemplate arg)`
    `static <I,R> SqlTemplate<I,R>` | `newInstance(SqlTemplate arg, io.vertx.lang.rx.TypeArg<I> __typeArg_I, io.vertx.lang.rx.TypeArg<R> __typeArg_R)`
    `Single<R>` | `rxExecute(I parameters)` Execute the query with the `parameters`
    `Single<R>` | `rxExecuteBatch(List<I> batch)` Execute a batch query with the `batch`.
    `String` | `toString()`

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

    - #### __typeArg_0

          public final io.vertx.lang.rx.TypeArg<I> __typeArg_0

    - #### __typeArg_1

          public final io.vertx.lang.rx.TypeArg<R> __typeArg_1

  - ### Constructor Detail

    - #### SqlTemplate

          public SqlTemplate(SqlTemplate delegate)

    - #### SqlTemplate

          public SqlTemplate(Object delegate,
                             io.vertx.lang.rx.TypeArg<I> typeArg_0,
                             io.vertx.lang.rx.TypeArg<R> typeArg_1)

  - ### Method Detail

    - #### toString

          public String toString()

      Overrides:
        `toString` in class `Object`

    - #### equals

          public boolean equals(Object o)

      Overrides:
        `equals` in class `Object`

    - #### hashCode

          public int hashCode()

      Overrides:
        `hashCode` in class `Object`

    - #### getDelegate

          public SqlTemplate getDelegate()

    - #### forQuery

          public static SqlTemplate<Map<String,Object>,RowSet<Row>> forQuery(SqlClient client,
                                                                             String template)

      Create an SQL template for query purpose consuming map parameters and returning .
      Parameters:
        `client` - the wrapped SQL client
        `template` - the template query string
      Returns:
        the template

    - #### forUpdate

          public static SqlTemplate<Map<String,Object>,SqlResult<Void>> forUpdate(SqlClient client,
                                                                                  String template)

      Create an SQL template for query purpose consuming map parameters and returning void.
      Parameters:
        `client` - the wrapped SQL client
        `template` - the template update string
      Returns:
        the template

    - #### mapFrom

          public <T> SqlTemplate<T,R> mapFrom(TupleMapper<T> mapper)

      Set a parameters user defined mapping function.

      At query execution, the `mapper` is called to map the parameters object to a `Tuple` that configures the prepared query.

      Parameters:
        `mapper` - the mapping function
      Returns:
        a new template

    - #### mapFrom

          public <T> SqlTemplate<T,R> mapFrom(Class<T> type)

      Set a parameters user defined class mapping.

      At query execution, the parameters object is is mapped to a `Map` that configures the prepared query.

      This feature relies on `JsonObject` feature. This likely requires to use Jackson databind in the project.

      Parameters:
        `type` - the mapping type
      Returns:
        a new template

    - #### mapTo

          public <U> SqlTemplate<I,RowSet<U>> mapTo(RowMapper<U> mapper)

      Set a row user defined mapping function.

      When the query execution completes, the `mapper` function is called to map the resulting rows to objects.

      Parameters:
        `mapper` - the mapping function
      Returns:
        a new template

    - #### mapTo

          public <U> SqlTemplate<I,RowSet<U>> mapTo(Class<U> type)

      Set a row user defined mapping function.

      When the query execution completes, resulting rows are mapped to `type` instances.

      This feature relies on `JsonObject` feature. This likely requires to use Jackson databind in the project.

      Parameters:
        `type` - the mapping type
      Returns:
        a new template

    - #### execute

          public void execute(I parameters,
                              Handler<AsyncResult<R>> handler)

      Execute the query with the `parameters`
      Parameters:
        `parameters` - the query parameters
        `handler` - the result handler

    - #### execute

          public void execute(I parameters)

      Execute the query with the `parameters`
      Parameters:
        `parameters` - the query parameters

    - #### rxExecute

          public Single<R> rxExecute(I parameters)

      Execute the query with the `parameters`
      Parameters:
        `parameters` - the query parameters
      Returns:

    - #### executeBatch

          public void executeBatch(List<I> batch,
                                   Handler<AsyncResult<R>> handler)

      Execute a batch query with the `batch`.

      Each item in the batch is mapped to a tuple.

      Parameters:
        `batch` - the batch
        `handler` - the result handler

    - #### executeBatch

          public void executeBatch(List<I> batch)

      Execute a batch query with the `batch`.

      Each item in the batch is mapped to a tuple.

      Parameters:
        `batch` - the batch

    - #### rxExecuteBatch

          public Single<R> rxExecuteBatch(List<I> batch)

      Execute a batch query with the `batch`.

      Each item in the batch is mapped to a tuple.

      Parameters:
        `batch` - the batch
      Returns:

    - #### newInstance

          public static <I,R> SqlTemplate<I,R> newInstance(SqlTemplate arg)

    - #### newInstance

          public static <I,R> SqlTemplate<I,R> newInstance(SqlTemplate arg,
                                                           io.vertx.lang.rx.TypeArg<I> __typeArg_I,
                                                           io.vertx.lang.rx.TypeArg<R> __typeArg_R)

Copyright © 2021 Eclipse. All rights reserved.