Class SqlTemplate<I,R>
- All Implemented Interfaces:
MutinyDelegate
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 theoriginal
non Mutiny-ified interface using Vert.x codegen.-
Field Summary
Fields -
Constructor Summary
ConstructorsConstructorDescriptionSqlTemplate
(io.vertx.sqlclient.templates.SqlTemplate delegate) SqlTemplate
(io.vertx.sqlclient.templates.SqlTemplate delegate, TypeArg<I> typeArg_0, TypeArg<R> typeArg_1) -
Method Summary
Modifier and TypeMethodDescriptionboolean
io.smallrye.mutiny.Uni<R>
Execute the query with theparameters
executeAndAwait
(I parameters) Blocking variant ofexecute(I)
.void
executeAndForget
(I parameters) Variant ofexecute(I)
that ignores the result of the operation.io.smallrye.mutiny.Uni<R>
executeBatch
(List<I> batch) Execute a batch query with thebatch
.executeBatchAndAwait
(List<I> batch) Blocking variant ofexecuteBatch(List)
.void
executeBatchAndForget
(List<I> batch) Variant ofexecuteBatch(List)
that ignores the result of the operation.io.vertx.sqlclient.templates.SqlTemplate
int
hashCode()
<T> SqlTemplate<T,
R> mapFrom
(TupleMapper<T> mapper) <T> SqlTemplate<T,
R> <U> SqlTemplate<I,
RowSet<U>> <U> SqlTemplate<I,
RowSet<U>> static <I,
R> SqlTemplate<I, R> newInstance
(io.vertx.sqlclient.templates.SqlTemplate arg) static <I,
R> SqlTemplate<I, R> newInstance
(io.vertx.sqlclient.templates.SqlTemplate arg, TypeArg<I> __typeArg_I, TypeArg<R> __typeArg_R) toString()
-
Field Details
-
__TYPE_ARG
-
__typeArg_0
-
__typeArg_1
-
-
Constructor Details
-
SqlTemplate
public SqlTemplate(io.vertx.sqlclient.templates.SqlTemplate delegate) -
SqlTemplate
-
SqlTemplate
-
-
Method Details
-
getDelegate
public io.vertx.sqlclient.templates.SqlTemplate getDelegate()- Specified by:
getDelegate
in interfaceMutinyDelegate
- Returns:
- the delegate used by this Mutiny object of generated type
-
toString
-
equals
-
hashCode
public int hashCode() -
forQuery
public static SqlTemplate<Map<String,Object>, forQueryRowSet<Row>> (SqlClient client, String template) - Parameters:
client
- the wrapped SQL clienttemplate
- the template query string- Returns:
- the template
-
forUpdate
public static SqlTemplate<Map<String,Object>, forUpdateSqlResult<Void>> (SqlClient client, String template) - Parameters:
client
- the wrapped SQL clienttemplate
- the template update string- Returns:
- the template
-
mapFrom
- Parameters:
mapper
- the mapping function- Returns:
- a new template
-
mapFrom
- Parameters:
type
- the mapping type- Returns:
- a new template
-
mapTo
- Parameters:
mapper
- the mapping function- Returns:
- a new template
-
mapTo
- Parameters:
type
- the mapping type- Returns:
- a new template
-
execute
Execute the query with theparameters
Unlike the bare Vert.x variant, this method returns a
Uni
. Don't forget to subscribe on it to trigger the operation.- Parameters:
parameters
- the query parameters- Returns:
- the
uni
firing the result of the operation when completed, or a failure if the operation failed.
-
executeAndAwait
Blocking variant ofexecute(I)
.This method waits 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 a RuntimeException).
- Parameters:
parameters
- the query parameters- Returns:
- the R instance produced by the operation.
-
executeAndForget
Variant ofexecute(I)
that ignores the result of the operation.This method subscribes on the result of
execute(I)
, but discards the outcome (item or failure). This method is useful to trigger the asynchronous operation fromexecute(I)
but you don't need to compose it with other operations.- Parameters:
parameters
- the query parameters
-
executeBatch
Execute a batch query with thebatch
.Each item in the batch is mapped to a tuple.
Unlike the bare Vert.x variant, this method returns a
Uni
. Don't forget to subscribe on it to trigger the operation.- Parameters:
batch
- the batch- Returns:
- the
uni
firing the result of the operation when completed, or a failure if the operation failed.
-
executeBatchAndAwait
Blocking variant ofexecuteBatch(List)
.This method waits 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 a RuntimeException).
- Parameters:
batch
- the batch- Returns:
- the R instance produced by the operation.
-
executeBatchAndForget
Variant ofexecuteBatch(List)
that ignores the result of the operation.This method subscribes on the result of
executeBatch(List)
, but discards the outcome (item or failure). This method is useful to trigger the asynchronous operation fromexecuteBatch(List)
but you don't need to compose it with other operations.- Parameters:
batch
- the batch
-
newInstance
-
newInstance
public static <I,R> SqlTemplate<I,R> newInstance(io.vertx.sqlclient.templates.SqlTemplate arg, TypeArg<I> __typeArg_I, TypeArg<R> __typeArg_R)
-