Class AbstractReactiveMybatisExecutor
- java.lang.Object
-
- pro.chenggang.project.reactive.mybatis.support.r2dbc.executor.AbstractReactiveMybatisExecutor
-
- All Implemented Interfaces:
ReactiveMybatisExecutor
- Direct Known Subclasses:
DefaultReactiveMybatisExecutor
public abstract class AbstractReactiveMybatisExecutor extends Object implements ReactiveMybatisExecutor
The type Abstract reactive mybatis executor.Concentrate on operation with connection
- Since:
- 1.0.0
- Author:
- Gang Cheng
-
-
Field Summary
Fields Modifier and Type Field Description protected R2dbcMybatisConfigurationconfigurationThe Configuration.protected io.r2dbc.spi.ConnectionFactoryconnectionFactoryThe Connection factory.
-
Constructor Summary
Constructors Modifier Constructor Description protectedAbstractReactiveMybatisExecutor(R2dbcMybatisConfiguration configuration, io.r2dbc.spi.ConnectionFactory connectionFactory)Instantiates a new Abstract reactive mybatis executor.
-
Method Summary
All Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description reactor.core.publisher.Mono<Void>close(boolean forceRollback)close sessionprotected reactor.core.publisher.Mono<Void>closeConnection(io.r2dbc.spi.Connection connection)Release theConnection.reactor.core.publisher.Mono<Void>commit(boolean required)commit transactionprotected abstract <E> reactor.core.publisher.Flux<E>doQueryWithConnection(io.r2dbc.spi.Connection connection, org.apache.ibatis.mapping.MappedStatement mappedStatement, Object parameter, org.apache.ibatis.session.RowBounds rowBounds)do query with connection actuallyprotected abstract reactor.core.publisher.Mono<Integer>doUpdateWithConnection(io.r2dbc.spi.Connection connection, org.apache.ibatis.mapping.MappedStatement mappedStatement, Object parameter)do update with connection actuallyprotected <T> reactor.core.publisher.Mono<T>inConnection(io.r2dbc.spi.ConnectionFactory connectionFactory, Function<io.r2dbc.spi.Connection,reactor.core.publisher.Mono<T>> action)in connectionprotected <T> reactor.core.publisher.Flux<T>inConnectionMany(io.r2dbc.spi.ConnectionFactory connectionFactory, Function<io.r2dbc.spi.Connection,reactor.core.publisher.Flux<T>> action)in connection many<E> reactor.core.publisher.Flux<E>query(org.apache.ibatis.mapping.MappedStatement mappedStatement, Object parameter, org.apache.ibatis.session.RowBounds rowBounds)execute queryreactor.core.publisher.Mono<Void>rollback(boolean required)rollback transactionreactor.core.publisher.Mono<Integer>update(org.apache.ibatis.mapping.MappedStatement mappedStatement, Object parameter)execute update
-
-
-
Field Detail
-
configuration
protected final R2dbcMybatisConfiguration configuration
The Configuration.
-
connectionFactory
protected final io.r2dbc.spi.ConnectionFactory connectionFactory
The Connection factory.
-
-
Constructor Detail
-
AbstractReactiveMybatisExecutor
protected AbstractReactiveMybatisExecutor(R2dbcMybatisConfiguration configuration, io.r2dbc.spi.ConnectionFactory connectionFactory)
Instantiates a new Abstract reactive mybatis executor.- Parameters:
configuration- the configurationconnectionFactory- the connection factory
-
-
Method Detail
-
update
public reactor.core.publisher.Mono<Integer> update(org.apache.ibatis.mapping.MappedStatement mappedStatement, Object parameter)
Description copied from interface:ReactiveMybatisExecutorexecute update- Specified by:
updatein interfaceReactiveMybatisExecutor- Parameters:
mappedStatement- the mapped statementparameter- the parameter- Returns:
- mono
-
query
public <E> reactor.core.publisher.Flux<E> query(org.apache.ibatis.mapping.MappedStatement mappedStatement, Object parameter, org.apache.ibatis.session.RowBounds rowBounds)Description copied from interface:ReactiveMybatisExecutorexecute query- Specified by:
queryin interfaceReactiveMybatisExecutor- Type Parameters:
E- the type parameter- Parameters:
mappedStatement- the mapped statementparameter- the parameterrowBounds- the row bounds- Returns:
- flux
-
commit
public reactor.core.publisher.Mono<Void> commit(boolean required)
Description copied from interface:ReactiveMybatisExecutorcommit transaction- Specified by:
commitin interfaceReactiveMybatisExecutor- Parameters:
required- the required- Returns:
- mono
-
rollback
public reactor.core.publisher.Mono<Void> rollback(boolean required)
Description copied from interface:ReactiveMybatisExecutorrollback transaction- Specified by:
rollbackin interfaceReactiveMybatisExecutor- Parameters:
required- the required- Returns:
- mono
-
close
public reactor.core.publisher.Mono<Void> close(boolean forceRollback)
Description copied from interface:ReactiveMybatisExecutorclose session- Specified by:
closein interfaceReactiveMybatisExecutor- Parameters:
forceRollback- the force rollback- Returns:
- mono
-
doUpdateWithConnection
protected abstract reactor.core.publisher.Mono<Integer> doUpdateWithConnection(io.r2dbc.spi.Connection connection, org.apache.ibatis.mapping.MappedStatement mappedStatement, Object parameter)
do update with connection actually- Parameters:
connection- the connectionmappedStatement- the mapped statementparameter- the parameter- Returns:
- mono
-
doQueryWithConnection
protected abstract <E> reactor.core.publisher.Flux<E> doQueryWithConnection(io.r2dbc.spi.Connection connection, org.apache.ibatis.mapping.MappedStatement mappedStatement, Object parameter, org.apache.ibatis.session.RowBounds rowBounds)do query with connection actually- Type Parameters:
E- the type parameter- Parameters:
connection- the connectionmappedStatement- the mapped statementparameter- the parameterrowBounds- the row bounds- Returns:
- flux
-
inConnection
protected <T> reactor.core.publisher.Mono<T> inConnection(io.r2dbc.spi.ConnectionFactory connectionFactory, Function<io.r2dbc.spi.Connection,reactor.core.publisher.Mono<T>> action)in connection- Type Parameters:
T- the type parameter- Parameters:
connectionFactory- the connection factoryaction- the action- Returns:
- mono
-
inConnectionMany
protected <T> reactor.core.publisher.Flux<T> inConnectionMany(io.r2dbc.spi.ConnectionFactory connectionFactory, Function<io.r2dbc.spi.Connection,reactor.core.publisher.Flux<T>> action)in connection many- Type Parameters:
T- the type parameter- Parameters:
connectionFactory- the connection factoryaction- the action- Returns:
- flux
-
closeConnection
protected reactor.core.publisher.Mono<Void> closeConnection(io.r2dbc.spi.Connection connection)
Release theConnection.- Parameters:
connection- the connection- Returns:
- mono
-
-