Package io.micronaut.data.runtime.mapper
Interface QueryStatement<PS,IDX>
- Type Parameters:
PS
- The statement typeIDX
- The index type
- All Known Implementing Classes:
JdbcQueryStatement
,R2dbcQueryStatement
public interface QueryStatement<PS,IDX>
An abstract interface over prepared statements.
-
Method Summary
Modifier and TypeMethodDescriptiondefault <T> T
convertRequired
(@Nullable Object value, Class<T> type) Convert the value to the given type.default io.micronaut.core.convert.ConversionService
Get conversion service.default @NonNull QueryStatement<PS,
IDX> Sets an array value for the given name.default @NonNull QueryStatement<PS,
IDX> setBigDecimal
(PS statement, IDX name, BigDecimal bd) Write a BigDecimal value for the given name.default @NonNull QueryStatement<PS,
IDX> setBoolean
(PS statement, IDX name, boolean bool) Write a boolean value for the given name.default @NonNull QueryStatement<PS,
IDX> Write a byte value for the given name.default @NonNull QueryStatement<PS,
IDX> Write a byte[] value for the given name.default @NonNull QueryStatement<PS,
IDX> Write a char value for the given name.default @NonNull QueryStatement<PS,
IDX> Write a date value for the given name.default @NonNull QueryStatement<PS,
IDX> Write a double value for the given name.default QueryStatement<PS,
IDX> setDynamic
(PS statement, IDX index, @NonNull DataType dataType, Object value) Write a value dynamically using the result set and the given name and data type.default @NonNull QueryStatement<PS,
IDX> Write a float value for the given name.default @NonNull QueryStatement<PS,
IDX> Write an int value for the given name.default @NonNull QueryStatement<PS,
IDX> Write a long value for the given name.default @NonNull QueryStatement<PS,
IDX> Write a short value for the given name.default QueryStatement<PS,
IDX> Write a string value for the given name.default QueryStatement<PS,
IDX> Write an instant value for the given name.default @NonNull QueryStatement<PS,
IDX> setTimestamp
(PS statement, IDX name, Instant instant) Write an instant value for the given name.Sets the give given object value.
-
Method Details
-
setValue
Sets the give given object value.- Parameters:
statement
- The statementindex
- The indexvalue
- The value- Returns:
- this writer
- Throws:
DataAccessException
- if the value cannot be read
-
setDynamic
default QueryStatement<PS,IDX> setDynamic(@NonNull PS statement, @NonNull IDX index, @NonNull @NonNull DataType dataType, Object value) Write a value dynamically using the result set and the given name and data type.- Parameters:
statement
- The statementindex
- The indexdataType
- The data typevalue
- the value- Returns:
- The writer
- Throws:
DataAccessException
- if the value cannot be read
-
convertRequired
Convert the value to the given type.- Type Parameters:
T
- The generic type- Parameters:
value
- The valuetype
- The type- Returns:
- The converted value
- Throws:
DataAccessException
- if the value cannot be converted
-
setLong
Write a long value for the given name.- Parameters:
statement
- The statementname
- The name (such as the column name)value
- The value- Returns:
- This writer
-
setChar
Write a char value for the given name.- Parameters:
statement
- The statementname
- The name (such as the column name)value
- The char value- Returns:
- This writer
-
setDate
Write a date value for the given name.- Parameters:
statement
- The statementname
- The name (such as the column name)date
- The date- Returns:
- This writer
-
setTimestamp
@NonNull default @NonNull QueryStatement<PS,IDX> setTimestamp(PS statement, IDX name, Instant instant) Write an instant value for the given name.- Parameters:
statement
- The statementname
- The name (such as the column name)instant
- The instant- Returns:
- This writer
- Since:
- 3.4.2
-
setTime
Write an instant value for the given name.- Parameters:
statement
- The statementname
- The name (such as the column name)instant
- The time- Returns:
- This writer
- Since:
- 3.8
-
setString
Write a string value for the given name.- Parameters:
statement
- The statementname
- The name (such as the column name)string
- The string- Returns:
- This writer
-
setInt
Write an int value for the given name.- Parameters:
statement
- The statementname
- The name (such as the column name)integer
- The integer- Returns:
- This writer
-
setBoolean
Write a boolean value for the given name.- Parameters:
statement
- The statementname
- The name (such as the column name)bool
- The boolean- Returns:
- This writer
-
setFloat
Write a float value for the given name.- Parameters:
statement
- The statementname
- The name (such as the column name)f
- The float- Returns:
- This writer
-
setByte
Write a byte value for the given name.- Parameters:
statement
- The statementname
- The name (such as the column name)b
- The byte- Returns:
- This writer
-
setShort
Write a short value for the given name.- Parameters:
statement
- The statementname
- The name (such as the column name)s
- The short- Returns:
- This writer
-
setDouble
Write a double value for the given name.- Parameters:
statement
- The statementname
- The name (such as the column name)d
- The double- Returns:
- This writer
-
setBigDecimal
@NonNull default @NonNull QueryStatement<PS,IDX> setBigDecimal(PS statement, IDX name, BigDecimal bd) Write a BigDecimal value for the given name.- Parameters:
statement
- The statementname
- The name (such as the column name)bd
- The big decimal- Returns:
- This writer
-
setBytes
Write a byte[] value for the given name.- Parameters:
statement
- The statementname
- The name (such as the column name)bytes
- the bytes- Returns:
- This writer
-
setArray
Sets an array value for the given name.- Parameters:
statement
- The statementname
- The name (such as the column name)array
- the array- Returns:
- This writer
-
getConversionService
default io.micronaut.core.convert.ConversionService getConversionService()Get conversion service.- Returns:
- the instance of
ConversionService
-