Interface StatementMapper
- All Known Subinterfaces:
StatementMapper.TypedStatementMapper<T>
public interface StatementMapper
Mapper for statement specifications to
PreparedOperation
. Statement mapping applies a
R2dbcDialect
-specific transformation considering
BindMarkers
and vendor-specific SQL differences.
Mapped statements
can be used directly with
DatabaseClient.sql(Supplier)
without specifying further SQL or bindings as the
prepared operation encapsulates the specified SQL operation.
- Author:
- Mark Paluch, Roman Chigvintsev, Mingyuan Wu, Diego Krupitza
-
Nested Class Summary
Modifier and TypeInterfaceDescriptionstatic class
DELETE
specification.static class
INSERT
specification.static class
SELECT
specification.static interface
Extension toStatementMapper
that is associated with a type.static class
UPDATE
specification. -
Method Summary
Modifier and TypeMethodDescriptionstatic StatementMapper
create
(R2dbcDialect dialect, R2dbcConverter converter) default StatementMapper.DeleteSpec
createDelete
(String table) Create aDELETE
specification fortable
.default StatementMapper.DeleteSpec
createDelete
(SqlIdentifier table) Create aDELETE
specification fortable
.default StatementMapper.InsertSpec
createInsert
(String table) Create anINSERT
specification fortable
.default StatementMapper.InsertSpec
createInsert
(SqlIdentifier table) Create anINSERT
specification fortable
.default StatementMapper.SelectSpec
createSelect
(String table) Create aSELECT
specification fortable
.default StatementMapper.SelectSpec
createSelect
(SqlIdentifier table) Create aSELECT
specification fortable
.default StatementMapper.UpdateSpec
createUpdate
(String table, Update update) Create anUPDATE
specification fortable
.default StatementMapper.UpdateSpec
createUpdate
(SqlIdentifier table, Update update) Create anUPDATE
specification fortable
.Create a typedStatementMapper
that considers type-specific mapping metadata.getMappedObject
(StatementMapper.DeleteSpec deleteSpec) Map a delete specification to aPreparedOperation
.getMappedObject
(StatementMapper.InsertSpec insertSpec) Map a insert specification to aPreparedOperation
.getMappedObject
(StatementMapper.SelectSpec selectSpec) Map a select specification to aPreparedOperation
.getMappedObject
(StatementMapper.UpdateSpec updateSpec) Map a update specification to aPreparedOperation
.default RenderContext
ReturnsRenderContext
.
-
Method Details
-
create
- Parameters:
dialect
- must not be null.converter
- must not be null.- Returns:
- the new
StatementMapper
. - Since:
- 1.2
-
forType
Create a typedStatementMapper
that considers type-specific mapping metadata.- Type Parameters:
T
-- Parameters:
type
- must not be null.- Returns:
- the typed
StatementMapper
.
-
getMappedObject
Map a select specification to aPreparedOperation
.- Parameters:
selectSpec
- the insert operation definition, must not be null.- Returns:
- the
PreparedOperation
forStatementMapper.SelectSpec
.
-
getMappedObject
Map a insert specification to aPreparedOperation
.- Parameters:
insertSpec
- the insert operation definition, must not be null.- Returns:
- the
PreparedOperation
forStatementMapper.InsertSpec
.
-
getMappedObject
Map a update specification to aPreparedOperation
.- Parameters:
updateSpec
- the update operation definition, must not be null.- Returns:
- the
PreparedOperation
forStatementMapper.UpdateSpec
.
-
getMappedObject
Map a delete specification to aPreparedOperation
.- Parameters:
deleteSpec
- the update operation definition, must not be null.- Returns:
- the
PreparedOperation
forStatementMapper.DeleteSpec
.
-
createSelect
Create aSELECT
specification fortable
.- Parameters:
table
-- Returns:
- the
StatementMapper.SelectSpec
.
-
createSelect
Create aSELECT
specification fortable
.- Parameters:
table
-- Returns:
- the
StatementMapper.SelectSpec
. - Since:
- 1.1
-
createInsert
Create anINSERT
specification fortable
.- Parameters:
table
-- Returns:
- the
StatementMapper.InsertSpec
.
-
createInsert
Create anINSERT
specification fortable
.- Parameters:
table
-- Returns:
- the
StatementMapper.InsertSpec
. - Since:
- 1.1
-
createUpdate
Create anUPDATE
specification fortable
.- Parameters:
table
-- Returns:
- the
StatementMapper.UpdateSpec
.
-
createUpdate
Create anUPDATE
specification fortable
.- Parameters:
table
-- Returns:
- the
StatementMapper.UpdateSpec
. - Since:
- 1.1
-
createDelete
Create aDELETE
specification fortable
.- Parameters:
table
-- Returns:
- the
StatementMapper.DeleteSpec
.
-
createDelete
Create aDELETE
specification fortable
.- Parameters:
table
-- Returns:
- the
StatementMapper.DeleteSpec
. - Since:
- 1.1
-
getRenderContext
ReturnsRenderContext
.- Returns:
RenderContext
instance or null ifRenderContext
is not available
-