Class DefaultReactiveSqlSession
- java.lang.Object
-
- pro.chenggang.project.reactive.mybatis.support.r2dbc.defaults.DefaultReactiveSqlSession
-
- All Implemented Interfaces:
MybatisReactiveContextManager,ReactiveSqlSession
public class DefaultReactiveSqlSession extends Object implements ReactiveSqlSession, MybatisReactiveContextManager
The type Default reactive sql session.- Version:
- 1.0.0
- Author:
- Gang Cheng
-
-
Constructor Summary
Constructors Constructor Description DefaultReactiveSqlSession(R2dbcMybatisConfiguration configuration, ReactiveMybatisExecutor reactiveMybatisExecutor)Instantiates a new Default reactive sql session.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description reactor.core.publisher.Mono<Void>close()close sessionreactor.core.publisher.Mono<Void>commit(boolean force)Perform commits database connection.reactor.core.publisher.Mono<Integer>delete(String statement, Object parameter)Execute a delete statement.R2dbcMybatisConfigurationgetConfiguration()Retrieves current configuration.<T> TgetMapper(Class<T> type)Retrieves a mapper.reactor.util.context.ContextinitReactiveExecutorContext(reactor.util.context.Context context)init reactive executor contextreactor.util.context.ContextinitReactiveExecutorContext(reactor.util.context.Context context, R2dbcStatementLog r2dbcStatementLog)init reactive executor context with R2dbcStatementLogreactor.core.publisher.Mono<Integer>insert(String statement, Object parameter)Execute an insert statement with the given parameter object.reactor.core.publisher.Mono<Void>rollback(boolean force)Discards pending batch statements and rolls database connection back.<E> reactor.core.publisher.Flux<E>selectList(String statement, Object parameter, org.apache.ibatis.session.RowBounds rowBounds)Retrieve many mapped objects from the statement key and parameter, within the specified row bounds.<T> reactor.core.publisher.Mono<T>selectOne(String statement, Object parameter)Retrieve a single row mapped from the statement key and parameter.ReactiveSqlSessionsetAutoCommit(boolean autoCommit)set auto commitReactiveSqlSessionsetIsolationLevel(io.r2dbc.spi.IsolationLevel isolationLevel)set isolation levelreactor.core.publisher.Mono<Integer>update(String statement, Object parameter)Execute an update statement.ReactiveSqlSessionusingTransaction(boolean usingTransactionSupport)set transaction or not-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface pro.chenggang.project.reactive.mybatis.support.r2dbc.ReactiveSqlSession
commit, delete, insert, rollback, selectList, selectList, selectOne, update
-
-
-
-
Constructor Detail
-
DefaultReactiveSqlSession
public DefaultReactiveSqlSession(R2dbcMybatisConfiguration configuration, ReactiveMybatisExecutor reactiveMybatisExecutor)
Instantiates a new Default reactive sql session.- Parameters:
configuration- the configurationreactiveMybatisExecutor- the reactive mybatis executor
-
-
Method Detail
-
setAutoCommit
public ReactiveSqlSession setAutoCommit(boolean autoCommit)
Description copied from interface:ReactiveSqlSessionset auto commit- Specified by:
setAutoCommitin interfaceReactiveSqlSession- Parameters:
autoCommit- the auto commit- Returns:
- current ReactiveSqlSession
-
setIsolationLevel
public ReactiveSqlSession setIsolationLevel(io.r2dbc.spi.IsolationLevel isolationLevel)
Description copied from interface:ReactiveSqlSessionset isolation level- Specified by:
setIsolationLevelin interfaceReactiveSqlSession- Parameters:
isolationLevel- the isolation level- Returns:
- current ReactiveSqlSession
-
usingTransaction
public ReactiveSqlSession usingTransaction(boolean usingTransactionSupport)
Description copied from interface:ReactiveSqlSessionset transaction or not- Specified by:
usingTransactionin interfaceReactiveSqlSession- Parameters:
usingTransactionSupport- the using transaction support- Returns:
- current ReactiveSqlSession
-
selectOne
public <T> reactor.core.publisher.Mono<T> selectOne(String statement, Object parameter)
Description copied from interface:ReactiveSqlSessionRetrieve a single row mapped from the statement key and parameter.- Specified by:
selectOnein interfaceReactiveSqlSession- Type Parameters:
T- the returned object type- Parameters:
statement- Unique identifier matching the statement to use.parameter- A parameter object to pass to the statement.- Returns:
- Mapped object
-
selectList
public <E> reactor.core.publisher.Flux<E> selectList(String statement, Object parameter, org.apache.ibatis.session.RowBounds rowBounds)
Description copied from interface:ReactiveSqlSessionRetrieve many mapped objects from the statement key and parameter, within the specified row bounds.- Specified by:
selectListin interfaceReactiveSqlSession- Type Parameters:
E- the returned list element type- Parameters:
statement- Unique identifier matching the statement to use.parameter- A parameter object to pass to the statement.rowBounds- Bounds to limit object retrieval- Returns:
- List of mapped object
-
insert
public reactor.core.publisher.Mono<Integer> insert(String statement, Object parameter)
Description copied from interface:ReactiveSqlSessionExecute an insert statement with the given parameter object. Any generated autoincrement values or selectKey entries will modify the given parameter object properties. Only the number of rows affected will be returned.- Specified by:
insertin interfaceReactiveSqlSession- Parameters:
statement- Unique identifier matching the statement to execute.parameter- A parameter object to pass to the statement.- Returns:
- int The number of rows affected by the insert.
-
update
public reactor.core.publisher.Mono<Integer> update(String statement, Object parameter)
Description copied from interface:ReactiveSqlSessionExecute an update statement. The number of rows affected will be returned.- Specified by:
updatein interfaceReactiveSqlSession- Parameters:
statement- Unique identifier matching the statement to execute.parameter- A parameter object to pass to the statement.- Returns:
- int The number of rows affected by the update.
-
delete
public reactor.core.publisher.Mono<Integer> delete(String statement, Object parameter)
Description copied from interface:ReactiveSqlSessionExecute a delete statement. The number of rows affected will be returned.- Specified by:
deletein interfaceReactiveSqlSession- Parameters:
statement- Unique identifier matching the statement to execute.parameter- A parameter object to pass to the statement.- Returns:
- int The number of rows affected by the delete.
-
commit
public reactor.core.publisher.Mono<Void> commit(boolean force)
Description copied from interface:ReactiveSqlSessionPerform commits database connection.- Specified by:
commitin interfaceReactiveSqlSession- Parameters:
force- forces connection commit- Returns:
- mono
-
rollback
public reactor.core.publisher.Mono<Void> rollback(boolean force)
Description copied from interface:ReactiveSqlSessionDiscards pending batch statements and rolls database connection back. Note that database connection will not be rolled back if no updates/deletes/inserts were called.- Specified by:
rollbackin interfaceReactiveSqlSession- Parameters:
force- forces connection rollback- Returns:
- mono
-
getConfiguration
public R2dbcMybatisConfiguration getConfiguration()
Description copied from interface:ReactiveSqlSessionRetrieves current configuration.- Specified by:
getConfigurationin interfaceReactiveSqlSession- Returns:
- R2dbcMybatisConfiguration configuration
-
getMapper
public <T> T getMapper(Class<T> type)
Description copied from interface:ReactiveSqlSessionRetrieves a mapper.- Specified by:
getMapperin interfaceReactiveSqlSession- Type Parameters:
T- the mapper type- Parameters:
type- Mapper interface class- Returns:
- a mapper bound to this SqlSession
-
close
public reactor.core.publisher.Mono<Void> close()
Description copied from interface:ReactiveSqlSessionclose session- Specified by:
closein interfaceReactiveSqlSession- Returns:
- mono
-
initReactiveExecutorContext
public reactor.util.context.Context initReactiveExecutorContext(reactor.util.context.Context context, R2dbcStatementLog r2dbcStatementLog)Description copied from interface:MybatisReactiveContextManagerinit reactive executor context with R2dbcStatementLog- Specified by:
initReactiveExecutorContextin interfaceMybatisReactiveContextManager- Parameters:
context- the contextr2dbcStatementLog- the statement log helper- Returns:
- context context
-
initReactiveExecutorContext
public reactor.util.context.Context initReactiveExecutorContext(reactor.util.context.Context context)
Description copied from interface:MybatisReactiveContextManagerinit reactive executor context- Specified by:
initReactiveExecutorContextin interfaceMybatisReactiveContextManager- Parameters:
context- the context- Returns:
- context context
-
-