├── .github └── workflows │ ├── workflow-2.x.yml │ └── workflow-3.x.yml ├── .gitignore ├── LICENSE ├── LICENSE_HEADER ├── README.md ├── mybatis-r2dbc-generator ├── pom.xml └── src │ ├── main │ ├── java │ │ └── pro │ │ │ └── chenggang │ │ │ └── project │ │ │ └── reactive │ │ │ └── mybatis │ │ │ └── support │ │ │ └── generator │ │ │ ├── core │ │ │ ├── MybatisDynamicCodeGenerator.java │ │ │ └── context │ │ │ │ ├── ContextGenerator.java │ │ │ │ ├── ContextGeneratorFactory.java │ │ │ │ └── impl │ │ │ │ ├── AbstractCommonContextGenerator.java │ │ │ │ ├── MyBatisSimpleContextGenerator.java │ │ │ │ ├── MyBatisSimpleModelContextGenerator.java │ │ │ │ ├── MyBatisSimpleModelXmlContextGenerator.java │ │ │ │ ├── MybatisDynamicContextGenerator.java │ │ │ │ └── MybatisDynamicMapperContextGenerator.java │ │ │ ├── option │ │ │ └── GeneratorType.java │ │ │ ├── plugin │ │ │ ├── comment │ │ │ │ └── CustomCommentGenerator.java │ │ │ ├── generator │ │ │ │ ├── CustomGeneratorPlugin.java │ │ │ │ └── DynamicGeneratorPlugin.java │ │ │ ├── other │ │ │ │ ├── RenameJavaMapperPlugin.java │ │ │ │ └── TrimTableNamePlugin.java │ │ │ └── type │ │ │ │ ├── CustomJavaTypeResolver.java │ │ │ │ └── GeneratedJavaTypeModifier.java │ │ │ ├── properties │ │ │ ├── FluentGeneratorPropertiesLoader.java │ │ │ ├── GeneratorProperties.java │ │ │ ├── GeneratorPropertiesBuilder.java │ │ │ ├── GeneratorPropertiesHolder.java │ │ │ ├── GeneratorPropertiesLoader.java │ │ │ └── YamlGeneratorPropertiesLoader.java │ │ │ └── support │ │ │ └── GeneratedModelCustomizer.java │ └── resources │ │ └── META-INF │ │ └── mybatis-generator.yml │ └── test │ ├── java │ └── pro │ │ └── chenggang │ │ └── project │ │ └── reactive │ │ └── mybatis │ │ └── support │ │ └── generator │ │ ├── MyBatisGeneratorAction.java │ │ ├── TestJavaTypeModifier.java │ │ ├── entity │ │ └── model │ │ │ ├── Dept.java │ │ │ └── Emp.java │ │ └── mapper │ │ ├── DeptMapper.java │ │ ├── EmpMapper.java │ │ └── dynamic │ │ ├── DeptDynamicMapper.java │ │ ├── DeptDynamicSqlSupport.java │ │ ├── EmpDynamicMapper.java │ │ └── EmpDynamicSqlSupport.java │ └── resources │ ├── mapper │ ├── DeptMapper.xml │ └── EmpMapper.xml │ ├── mybatis-generator.yml │ └── test_prepare.sql ├── mybatis-r2dbc-spring ├── pom.xml └── src │ ├── main │ ├── java │ │ └── pro │ │ │ └── chenggang │ │ │ └── project │ │ │ └── reactive │ │ │ └── mybatis │ │ │ └── support │ │ │ └── r2dbc │ │ │ └── spring │ │ │ ├── annotation │ │ │ ├── R2dbcMapperScan.java │ │ │ ├── R2dbcMapperScannerRegistrar.java │ │ │ └── R2dbcMapperScans.java │ │ │ ├── configuration │ │ │ ├── AutoExclusionFilter.java │ │ │ ├── MybatisLanguageDriverAutoConfiguration.java │ │ │ ├── R2dbcMybatisAutoConfiguration.java │ │ │ ├── SpringBootVFS.java │ │ │ └── routing │ │ │ │ ├── R2dbcMybatisMultiConnectionFactoryAutoInitializer.java │ │ │ │ └── R2dbcMybatisRoutingAutoConfiguration.java │ │ │ ├── executor │ │ │ └── SpringReactiveMybatisExecutor.java │ │ │ ├── mapper │ │ │ ├── ClassPathR2dbcMapperScanner.java │ │ │ ├── R2dbcMapperFactoryBean.java │ │ │ └── R2dbcMapperScannerConfigurer.java │ │ │ ├── properties │ │ │ ├── R2dbcMybatisConnectionFactoryProperties.java │ │ │ ├── R2dbcMybatisProperties.java │ │ │ └── R2dbcMybatisRoutingConnectionFactoryProperties.java │ │ │ ├── routing │ │ │ ├── BeanNameDynamicRoutingConnectionFactoryLoader.java │ │ │ ├── DynamicRoutingConnectionFactoryLoader.java │ │ │ ├── R2dbcMybatisDynamicRoutingConnectionFactory.java │ │ │ ├── R2dbcMybatisRoutingConnectionFactoryCustomizer.java │ │ │ └── context │ │ │ │ ├── R2dbcMybatisDatabaseRoutingContextHolder.java │ │ │ │ ├── R2dbcMybatisDatabaseRoutingContextManager.java │ │ │ │ ├── R2dbcMybatisDatabaseRoutingKeyInfo.java │ │ │ │ └── R2dbcMybatisDatabaseRoutingOperator.java │ │ │ ├── support │ │ │ ├── ConnectionFactoryOptionsCustomizer.java │ │ │ └── R2dbcMybatisConfigurationCustomizer.java │ │ │ └── xml │ │ │ ├── NamespaceHandler.java │ │ │ └── R2dbcMapperScannerBeanDefinitionParser.java │ └── resources │ │ ├── META-INF │ │ ├── spring.factories │ │ ├── spring.handlers │ │ ├── spring.schemas │ │ └── spring │ │ │ └── org.springframework.boot.autoconfigure.AutoConfiguration.imports │ │ └── pro │ │ └── chenggang │ │ └── project │ │ └── reactive │ │ └── mybatis │ │ └── support │ │ └── r2dbc │ │ └── spring │ │ └── xml │ │ └── mybatis-spring.xsd │ └── test │ ├── java │ └── pro │ │ └── chenggang │ │ └── project │ │ └── reactive │ │ └── mybatis │ │ └── support │ │ └── r2dbc │ │ └── spring │ │ ├── application │ │ ├── MybatisR2dbcApplication.java │ │ ├── configuration │ │ │ └── ApplicationConfiguration.java │ │ ├── mapper │ │ │ ├── query │ │ │ │ ├── dynamic │ │ │ │ │ └── DynamicQueryMapper.java │ │ │ │ ├── many │ │ │ │ │ └── ManyQueryMapper.java │ │ │ │ └── simple │ │ │ │ │ └── SimpleQueryMapper.java │ │ │ ├── repository │ │ │ │ └── SimpleQueryRepository.java │ │ │ ├── transaction │ │ │ │ ├── delete │ │ │ │ │ └── DeleteMapper.java │ │ │ │ ├── insert │ │ │ │ │ └── InsertMapper.java │ │ │ │ └── update │ │ │ │ │ └── UpdateMapper.java │ │ │ └── type │ │ │ │ ├── adapter │ │ │ │ └── AdapterMapper.java │ │ │ │ ├── basic │ │ │ │ └── BasicTypeMapper.java │ │ │ │ └── enums │ │ │ │ ├── EnumRelatedMapper.java │ │ │ │ ├── SpecificEnumType.java │ │ │ │ └── SpecificEnumTypeR2dbcTypeHandlerAdapter.java │ │ └── service │ │ │ ├── ApplicationService.java │ │ │ ├── DynamicRoutingService.java │ │ │ └── impl │ │ │ ├── ApplicationServiceImpl.java │ │ │ └── DynamicRoutingServiceImpl.java │ │ ├── common │ │ ├── entity │ │ │ ├── Dept.java │ │ │ ├── Emp.java │ │ │ ├── Subject.java │ │ │ ├── SubjectContent.java │ │ │ ├── SubjectData.java │ │ │ └── extend │ │ │ │ ├── DeptWithEmpList.java │ │ │ │ ├── EmpWithDept.java │ │ │ │ └── SubjectWithSubjectData.java │ │ ├── mapper │ │ │ ├── DeptMapper.java │ │ │ ├── EmpMapper.java │ │ │ ├── SubjectDataMapper.java │ │ │ ├── SubjectMapper.java │ │ │ └── dynamic │ │ │ │ ├── DeptDynamicMapper.java │ │ │ │ ├── DeptDynamicSqlSupport.java │ │ │ │ ├── EmpDynamicMapper.java │ │ │ │ ├── EmpDynamicSqlSupport.java │ │ │ │ ├── SubjectDataDynamicMapper.java │ │ │ │ ├── SubjectDataDynamicSqlSupport.java │ │ │ │ ├── SubjectDynamicMapper.java │ │ │ │ └── SubjectDynamicSqlSupport.java │ │ ├── option │ │ │ └── SubjectDataAnEnum.java │ │ └── testcontainers │ │ │ ├── DatabaseInitialization.java │ │ │ ├── MariadbTestContainerInitialization.java │ │ │ ├── MysqlTestContainerInitialization.java │ │ │ ├── OracleTestContainerInitialization.java │ │ │ ├── PostgresqlTestContainerInitialization.java │ │ │ ├── SqlServerTestContainerInitialization.java │ │ │ └── support │ │ │ └── ScriptRunner.java │ │ └── test │ │ ├── MybatisR2dbcApplicationTests.java │ │ ├── MybatisR2dbcBaseTests.java │ │ ├── MybatisR2dbcRoutingApplicationTests.java │ │ ├── MybatisR2dbcXmlConfigApplicationTests.java │ │ ├── config │ │ ├── MysqlConnectionFactoryOptionsConfigurer.java │ │ └── PostgresqlConnectionFactoryOptionsConfigurer.java │ │ ├── mapper │ │ ├── query │ │ │ ├── dynamic │ │ │ │ └── DynamicQueryMapperTests.java │ │ │ ├── many │ │ │ │ └── ManyQueryMapperTests.java │ │ │ └── simple │ │ │ │ └── SimpleQueryMapperTests.java │ │ ├── repository │ │ │ └── SimpleQueryRepositoryTests.java │ │ ├── transaction │ │ │ ├── delete │ │ │ │ └── DeleteMapperTest.java │ │ │ ├── insert │ │ │ │ └── InsertMapperTest.java │ │ │ ├── parallel │ │ │ │ └── ParallelTransactionTest.java │ │ │ └── update │ │ │ │ └── UpdateMapperTest.java │ │ └── type │ │ │ ├── adapter │ │ │ └── AdapterMapperTests.java │ │ │ ├── basic │ │ │ └── BasicTypeMapperTests.java │ │ │ └── enums │ │ │ ├── EnumOrdinalRelatedMapperTests.java │ │ │ └── EnumRelatedMapperTests.java │ │ └── service │ │ ├── ApplicationServiceTests.java │ │ └── DynamicRoutingServiceTests.java │ └── resources │ ├── MybatisR2dbcConfig.xml │ ├── application-routing.yml │ ├── application-standard.yml │ ├── application-xml-config.yml │ ├── container-license-acceptance.txt │ ├── logback-spring.xml │ ├── mapper │ ├── common │ │ ├── DeptMapper.xml │ │ ├── EmpMapper.xml │ │ ├── SubjectDataMapper.xml │ │ └── SubjectMapper.xml │ ├── query │ │ ├── many │ │ │ └── ManyQueryMapper.xml │ │ └── simple │ │ │ └── SimpleQueryMapper.xml │ ├── repository │ │ └── SimpleQueryRepository.xml │ ├── transaction │ │ ├── delete │ │ │ └── DeleteMapper.xml │ │ ├── insert │ │ │ └── InsertMapper.xml │ │ └── update │ │ │ └── UpdateMapper.xml │ └── type │ │ ├── adapter │ │ └── AdapterMapper.xml │ │ ├── basic │ │ └── BasicTypeMapper.xml │ │ └── enums │ │ └── EnumRelatedMapper.xml │ ├── mybatis-config.properties │ └── sql-script │ ├── init_mssql.sql │ ├── init_mysql.sql │ ├── init_oracle.sql │ └── init_postgresql.sql ├── mybatis-r2dbc ├── pom.xml └── src │ ├── main │ └── java │ │ └── pro │ │ └── chenggang │ │ └── project │ │ └── reactive │ │ └── mybatis │ │ └── support │ │ └── r2dbc │ │ ├── MybatisReactiveContextManager.java │ │ ├── ReactiveSqlSession.java │ │ ├── ReactiveSqlSessionFactory.java │ │ ├── ReactiveSqlSessionOperator.java │ │ ├── binding │ │ ├── MapperMethod.java │ │ ├── MapperProxy.java │ │ └── MapperProxyFactory.java │ │ ├── builder │ │ ├── ConnectionFactoryOptionsConfigurer.java │ │ ├── ConnectionPoolConfigurationConfigurer.java │ │ ├── R2dbcMapperAnnotationBuilder.java │ │ ├── R2dbcMapperMethodResolver.java │ │ ├── R2dbcXMLConfigBuilder.java │ │ ├── R2dbcXMLMapperBuilder.java │ │ └── R2dbcXMLStatementBuilder.java │ │ ├── connection │ │ ├── ConnectionCloseHolder.java │ │ └── DefaultTransactionSupportConnectionFactory.java │ │ ├── defaults │ │ ├── DefaultReactiveSqlSession.java │ │ ├── DefaultReactiveSqlSessionFactory.java │ │ ├── DefaultReactiveSqlSessionOperator.java │ │ └── ReactiveSqlSessionProfile.java │ │ ├── delegate │ │ ├── R2dbcMapperRegistry.java │ │ └── R2dbcMybatisConfiguration.java │ │ ├── dynamic │ │ ├── CommonCountMapper.java │ │ ├── CommonDeleteMapper.java │ │ ├── CommonGeneralInsertMapper.java │ │ ├── CommonInsertMapper.java │ │ ├── CommonSelectMapper.java │ │ ├── CommonUpdateMapper.java │ │ ├── ReactiveMyBatis3Utils.java │ │ ├── ToMonoIntBiFunction.java │ │ ├── ToMonoIntFunction.java │ │ └── ToMonoLongFunction.java │ │ ├── exception │ │ ├── GeneratedKeysException.java │ │ ├── R2dbcParameterException.java │ │ └── R2dbcResultException.java │ │ ├── executor │ │ ├── AbstractReactiveMybatisExecutor.java │ │ ├── DefaultReactiveMybatisExecutor.java │ │ ├── ReactiveMybatisExecutor.java │ │ ├── key │ │ │ ├── DefaultR2dbcKeyGenerator.java │ │ │ ├── KeyGeneratorType.java │ │ │ ├── NoKeyR2dbcKeyGenerator.java │ │ │ ├── R2dbcKeyGenerator.java │ │ │ └── SelectR2dbcKeyGenerator.java │ │ ├── parameter │ │ │ ├── DelegateR2dbcParameterHandler.java │ │ │ └── ParameterHandlerContext.java │ │ ├── placeholder │ │ │ ├── PlaceholderDialect.java │ │ │ ├── PlaceholderDialectRegistry.java │ │ │ ├── PlaceholderFormatter.java │ │ │ ├── defaults │ │ │ │ ├── DefaultPlaceholderDialectRegistry.java │ │ │ │ └── DefaultPlaceholderFormatter.java │ │ │ └── dialect │ │ │ │ ├── H2PlaceholderDialect.java │ │ │ │ ├── MariaDBPlaceholderDialect.java │ │ │ │ ├── MySQLPlaceholderDialect.java │ │ │ │ ├── NamePlaceholderDialect.java │ │ │ │ ├── OraclePlaceholderDialect.java │ │ │ │ ├── PostgreSQLPlaceholderDialect.java │ │ │ │ └── SQLServerPlaceholderDialect.java │ │ ├── result │ │ │ ├── ReadableResultWrapper.java │ │ │ ├── TypeHandleContext.java │ │ │ └── handler │ │ │ │ ├── DefaultReactiveResultHandler.java │ │ │ │ ├── DelegateR2dbcResultRowDataHandler.java │ │ │ │ └── ReactiveResultHandler.java │ │ ├── support │ │ │ ├── R2dbcStatementLog.java │ │ │ ├── R2dbcStatementLogFactory.java │ │ │ ├── ReactiveExecutorContext.java │ │ │ └── ReactiveExecutorContextAttribute.java │ │ └── type │ │ │ ├── R2dbcTypeHandlerAdapter.java │ │ │ ├── R2dbcTypeHandlerAdapterRegistry.java │ │ │ ├── converter │ │ │ ├── EnumMybatisTypeHandlerConverter.java │ │ │ ├── EnumOrdinalMybatisTypeHandlerConverter.java │ │ │ └── MybatisTypeHandlerConverter.java │ │ │ ├── defaults │ │ │ ├── ByteArrayR2dbcTypeHandlerAdapter.java │ │ │ ├── ByteObjectArrayR2dbcTypeHandlerAdapter.java │ │ │ ├── EnumOrdinalR2dbcTypeHandlerAdapter.java │ │ │ ├── EnumR2dbcTypeHandlerAdapter.java │ │ │ ├── OffsetDateTimeR2dbcTypeHandlerAdapter.java │ │ │ ├── OffsetTimeR2dbcTypeHandlerAdapter.java │ │ │ ├── R2dbcBlobTypeHandlerAdapter.java │ │ │ ├── R2dbcClobTypeHandlerAdapter.java │ │ │ ├── SqlDateR2dbcTypeHandlerAdapter.java │ │ │ ├── SqlTimeR2dbcTypeHandlerAdapter.java │ │ │ ├── TimestampR2dbcTypeHandlerAdapter.java │ │ │ └── ZonedDateTimeR2dbcTypeHandlerAdapter.java │ │ │ ├── mapping │ │ │ ├── DefaultR2DbcTypeMappingFactory.java │ │ │ └── R2dbcTypeMappingFactory.java │ │ │ └── support │ │ │ └── ForceToUseR2dbcTypeHandlerAdapter.java │ │ ├── mapping │ │ ├── R2dbcDatabaseIdProvider.java │ │ ├── R2dbcEnvironment.java │ │ └── R2dbcVendorDatabaseIdProvider.java │ │ └── support │ │ ├── ParameterBindingHelper.java │ │ └── ProxyInstanceFactory.java │ └── test │ ├── java │ └── pro │ │ └── chenggang │ │ └── project │ │ └── reactive │ │ └── mybatis │ │ └── support │ │ ├── MybatisR2dbcBaseTests.java │ │ ├── common │ │ ├── entity │ │ │ ├── Dept.java │ │ │ ├── Emp.java │ │ │ ├── Subject.java │ │ │ ├── SubjectContent.java │ │ │ ├── SubjectData.java │ │ │ └── extend │ │ │ │ ├── DeptWithEmpList.java │ │ │ │ ├── EmpWithDept.java │ │ │ │ └── SubjectWithSubjectData.java │ │ ├── mapper │ │ │ ├── DeptMapper.java │ │ │ ├── EmpMapper.java │ │ │ ├── SubjectDataMapper.java │ │ │ ├── SubjectMapper.java │ │ │ └── dynamic │ │ │ │ ├── DeptDynamicMapper.java │ │ │ │ ├── DeptDynamicSqlSupport.java │ │ │ │ ├── EmpDynamicMapper.java │ │ │ │ ├── EmpDynamicSqlSupport.java │ │ │ │ ├── SubjectDataDynamicMapper.java │ │ │ │ ├── SubjectDataDynamicSqlSupport.java │ │ │ │ ├── SubjectDynamicMapper.java │ │ │ │ └── SubjectDynamicSqlSupport.java │ │ ├── option │ │ │ └── SubjectDataAnEnum.java │ │ └── testcontainers │ │ │ ├── DatabaseInitialization.java │ │ │ ├── MariadbTestContainerInitialization.java │ │ │ ├── MysqlTestContainerInitialization.java │ │ │ ├── OracleTestContainerInitialization.java │ │ │ ├── PostgresqlTestContainerInitialization.java │ │ │ ├── SqlServerTestContainerInitialization.java │ │ │ └── support │ │ │ └── ScriptRunner.java │ │ └── r2dbc │ │ ├── binding │ │ ├── BindingMapperTests.java │ │ ├── BindingSimpleTests.java │ │ ├── MybatisR2dbcXmlConfigTests.java │ │ ├── MysqlConnectionFactoryOptionsConfigurer.java │ │ ├── MysqlConnectionPoolConfigurationConfigurer.java │ │ └── PostgresqlConnectionFactoryOptionsConfigurer.java │ │ ├── execution │ │ ├── procedure │ │ │ ├── ProcedureMapper.java │ │ │ ├── ProcedureMapperTests.java │ │ │ └── SimpleRowProcedureData.java │ │ ├── query │ │ │ ├── dynamic │ │ │ │ ├── DynamicQueryMapper.java │ │ │ │ └── DynamicQueryMapperTests.java │ │ │ ├── many │ │ │ │ ├── ManyQueryMapper.java │ │ │ │ └── ManyQueryMapperTests.java │ │ │ └── simple │ │ │ │ ├── SimpleQueryMapper.java │ │ │ │ └── SimpleQueryMapperTests.java │ │ ├── transaction │ │ │ ├── delete │ │ │ │ ├── DeleteMapper.java │ │ │ │ └── DeleteMapperTest.java │ │ │ ├── insert │ │ │ │ ├── InsertMapper.java │ │ │ │ └── InsertMapperTest.java │ │ │ ├── parallel │ │ │ │ └── ParallelTransactionTest.java │ │ │ └── update │ │ │ │ ├── UpdateMapper.java │ │ │ │ └── UpdateMapperTest.java │ │ └── type │ │ │ ├── adapter │ │ │ ├── AdapterMapper.java │ │ │ └── AdapterMapperTests.java │ │ │ ├── basic │ │ │ ├── BasicTypeMapper.java │ │ │ └── BasicTypeMapperTests.java │ │ │ └── enums │ │ │ ├── EnumRelatedMapper.java │ │ │ ├── EnumRelatedMapperTests.java │ │ │ ├── SpecificEnumType.java │ │ │ └── SpecificEnumTypeR2dbcTypeHandlerAdapter.java │ │ └── support │ │ └── ProxyInstanceFactoryTest.java │ └── resources │ ├── MybatisR2dbcConfig.xml │ ├── container-license-acceptance.txt │ ├── logback.xml │ ├── mybatis-config.properties │ ├── pro │ └── chenggang │ │ └── project │ │ └── reactive │ │ └── mybatis │ │ └── support │ │ ├── common │ │ ├── DeptMapper.xml │ │ ├── EmpMapper.xml │ │ ├── SubjectDataMapper.xml │ │ └── SubjectMapper.xml │ │ └── r2dbc │ │ └── execution │ │ ├── procedure │ │ └── ProcedureMapper.xml │ │ ├── query │ │ ├── many │ │ │ └── ManyQueryMapper.xml │ │ └── simple │ │ │ └── SimpleQueryMapper.xml │ │ ├── transaction │ │ ├── delete │ │ │ └── DeleteMapper.xml │ │ ├── insert │ │ │ └── InsertMapper.xml │ │ └── update │ │ │ └── UpdateMapper.xml │ │ └── type │ │ ├── adapter │ │ └── AdapterMapper.xml │ │ ├── basic │ │ └── BasicTypeMapper.xml │ │ └── enums │ │ └── EnumRelatedMapper.xml │ └── sql-script │ ├── init_mariadb.sql │ ├── init_mssql.sql │ ├── init_mysql.sql │ ├── init_oracle.sql │ └── init_postgresql.sql ├── pom.xml └── toolchains.xml /.github/workflows/workflow-2.x.yml: -------------------------------------------------------------------------------- 1 | name: Build and Test With Maven [2.x] 2 | 3 | on: 4 | workflow_dispatch: 5 | inputs: 6 | databaseType: 7 | type: choice 8 | required: true 9 | options: 10 | - MySQL 11 | - Mariadb 12 | - MSSQL 13 | - PostgreSQL 14 | - Oracle 15 | - All 16 | - None 17 | 18 | jobs: 19 | maven-build: 20 | concurrency: 21 | group: reactive-mybais-support 22 | cancel-in-progress: false 23 | runs-on: ubuntu-latest 24 | steps: 25 | - name: Checkout 26 | uses: actions/checkout@v4 27 | - name: Set up JDK 8 28 | uses: actions/setup-java@v2 29 | with: 30 | java-version: '8' 31 | distribution: 'adopt' 32 | cache: maven 33 | - name: Build With Maven 34 | run: mvn clean compile package -DskipTests --file pom.xml 35 | - name: Setup Testcontainers Cloud Client 36 | if: ${{ github.event.inputs.databaseType != 'None' }} 37 | uses: atomicjar/testcontainers-cloud-setup-action@v1 38 | with: 39 | token: ${{ secrets.TC_CLOUD_TOKEN }} 40 | - name: Run Tests With MySQLContainer 41 | if: ${{ contains(fromJSON('["All", "MySQL"]'), github.event.inputs.databaseType) }} 42 | run: mvn -B -DargLine="-DdatabaseType=MySQLContainer" test 43 | - name: Run Tests With MariaDBContainer 44 | if: ${{ contains(fromJSON('["All", "Mariadb"]'), github.event.inputs.databaseType) }} 45 | run: mvn -B -DargLine="-DdatabaseType=MariaDBContainer" test 46 | - name: Run Tests With PostgreSQLContainer 47 | if: ${{ contains(fromJSON('["All", "PostgreSQL"]'), github.event.inputs.databaseType) }} 48 | run: mvn -B -DargLine="-DdatabaseType=PostgreSQLContainer" test 49 | - name: Run Tests With MSSQLServerContainer 50 | if: ${{ contains(fromJSON('["All", "MSSQL"]'), github.event.inputs.databaseType) }} 51 | run: mvn -B -DargLine="-DdatabaseType=MSSQLServerContainer" test 52 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | HELP.md 2 | target/ 3 | !.mvn/wrapper/maven-wrapper.jar 4 | !**/src/main/**/target/ 5 | !**/src/test/**/target/ 6 | 7 | ### STS ### 8 | .apt_generated 9 | .classpath 10 | .factorypath 11 | .project 12 | .settings 13 | .springBeans 14 | .sts4-cache 15 | 16 | ### IntelliJ IDEA ### 17 | .idea 18 | *.iws 19 | *.iml 20 | *.ipr 21 | 22 | ### NetBeans ### 23 | /nbproject/private/ 24 | /nbbuild/ 25 | /dist/ 26 | /nbdist/ 27 | /.nb-gradle/ 28 | build/ 29 | !**/src/main/**/build/ 30 | !**/src/test/**/build/ 31 | 32 | ### VS Code ### 33 | .vscode/ 34 | 35 | **/src/main/resources/public/ 36 | **/target 37 | **/dist/ 38 | **/node/ 39 | **/node_modules/ 40 | **/npm-debug.log 41 | **/test-output 42 | **/tests/e2e/reports 43 | **/tests/unit/coverage 44 | **/yarn-error.log 45 | **/yarn.lock 46 | 47 | ### Mac ### 48 | .DS_Store 49 | 50 | ### Log ### 51 | logs/ -------------------------------------------------------------------------------- /LICENSE_HEADER: -------------------------------------------------------------------------------- 1 | Copyright ${license.git.copyrightYears} the original author or authors. 2 | 3 | Licensed under the Apache License, Version 2.0 (the "License"); 4 | you may not use this file except in compliance with the License. 5 | You may obtain a copy of the License at 6 | 7 | https://www.apache.org/licenses/LICENSE-2.0 8 | 9 | Unless required by applicable law or agreed to in writing, software 10 | distributed under the License is distributed on an "AS IS" BASIS, 11 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | See the License for the specific language governing permissions and 13 | limitations under the License. 14 | -------------------------------------------------------------------------------- /mybatis-r2dbc-generator/src/main/java/pro/chenggang/project/reactive/mybatis/support/generator/core/context/ContextGenerator.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2009-2023 the original author or authors. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * https://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package pro.chenggang.project.reactive.mybatis.support.generator.core.context; 17 | 18 | import org.mybatis.generator.config.Context; 19 | import pro.chenggang.project.reactive.mybatis.support.generator.option.GeneratorType; 20 | import pro.chenggang.project.reactive.mybatis.support.generator.properties.GeneratorProperties; 21 | 22 | /** 23 | * The Context generator. 24 | * 25 | * @author Gang Cheng 26 | * @version 2.0.0 27 | * @since 1.0.0 28 | */ 29 | public interface ContextGenerator { 30 | 31 | /** 32 | * generator type 33 | * 34 | * @return generator type 35 | */ 36 | GeneratorType targetGeneratorType(); 37 | 38 | /** 39 | * Generate generator context 40 | * 41 | * @param generatorProperties the generator properties 42 | * @return context 43 | */ 44 | Context generateContext(GeneratorProperties generatorProperties); 45 | } 46 | -------------------------------------------------------------------------------- /mybatis-r2dbc-generator/src/main/java/pro/chenggang/project/reactive/mybatis/support/generator/core/context/impl/MyBatisSimpleContextGenerator.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2009-2023 the original author or authors. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * https://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package pro.chenggang.project.reactive.mybatis.support.generator.core.context.impl; 17 | 18 | import org.mybatis.generator.config.Context; 19 | import org.mybatis.generator.config.ModelType; 20 | import pro.chenggang.project.reactive.mybatis.support.generator.option.GeneratorType; 21 | 22 | /** 23 | * The Mybatis simple context generator. 24 | * 25 | * @author Gang Cheng 26 | * @version 1.0.0 27 | */ 28 | public class MyBatisSimpleContextGenerator extends AbstractCommonContextGenerator { 29 | 30 | @Override 31 | public GeneratorType targetGeneratorType() { 32 | return GeneratorType.SIMPLE; 33 | } 34 | 35 | @Override 36 | protected Context newContext() { 37 | Context context = new Context(ModelType.FLAT); 38 | context.setTargetRuntime("MyBatis3Simple"); 39 | context.setId("MyBatis3Simple"); 40 | context.addProperty("javaFileEncoding", "UTF-8"); 41 | context.addProperty("columnOverride", "false"); 42 | return context; 43 | } 44 | 45 | } 46 | -------------------------------------------------------------------------------- /mybatis-r2dbc-generator/src/main/java/pro/chenggang/project/reactive/mybatis/support/generator/core/context/impl/MyBatisSimpleModelContextGenerator.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2009-2023 the original author or authors. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * https://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package pro.chenggang.project.reactive.mybatis.support.generator.core.context.impl; 17 | 18 | import org.mybatis.generator.config.Context; 19 | import org.mybatis.generator.config.ModelType; 20 | import pro.chenggang.project.reactive.mybatis.support.generator.option.GeneratorType; 21 | import pro.chenggang.project.reactive.mybatis.support.generator.properties.GeneratorProperties; 22 | 23 | /** 24 | * The Mybatis simple context generator. 25 | * 26 | * @author Gang Cheng 27 | * @version 1.0.0 28 | */ 29 | public class MyBatisSimpleModelContextGenerator extends AbstractCommonContextGenerator { 30 | 31 | @Override 32 | public GeneratorType targetGeneratorType() { 33 | return GeneratorType.MODEL; 34 | } 35 | 36 | @Override 37 | protected Context newContext() { 38 | Context context = new Context(ModelType.FLAT); 39 | context.setTargetRuntime("MyBatis3Simple"); 40 | context.setId("MyBatis3Simple"); 41 | context.addProperty("javaFileEncoding", "UTF-8"); 42 | context.addProperty("columnOverride", "false"); 43 | return context; 44 | } 45 | 46 | @Override 47 | protected void configureSqlMapGenerator(Context context, GeneratorProperties generatorProperties) { 48 | // disable original operation 49 | } 50 | 51 | @Override 52 | protected void configureJavaClientGenerator(Context context, GeneratorProperties generatorProperties) { 53 | // disable original operation 54 | } 55 | } 56 | -------------------------------------------------------------------------------- /mybatis-r2dbc-generator/src/main/java/pro/chenggang/project/reactive/mybatis/support/generator/core/context/impl/MyBatisSimpleModelXmlContextGenerator.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2009-2023 the original author or authors. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * https://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package pro.chenggang.project.reactive.mybatis.support.generator.core.context.impl; 17 | 18 | import org.mybatis.generator.config.Context; 19 | import org.mybatis.generator.config.ModelType; 20 | import pro.chenggang.project.reactive.mybatis.support.generator.option.GeneratorType; 21 | import pro.chenggang.project.reactive.mybatis.support.generator.properties.GeneratorProperties; 22 | 23 | /** 24 | * The Mybatis simple context generator. 25 | * 26 | * @author Gang Cheng 27 | * @version 1.0.0 28 | */ 29 | public class MyBatisSimpleModelXmlContextGenerator extends AbstractCommonContextGenerator { 30 | 31 | @Override 32 | public GeneratorType targetGeneratorType() { 33 | return GeneratorType.MODEL_XML; 34 | } 35 | 36 | @Override 37 | protected Context newContext() { 38 | Context context = new Context(ModelType.FLAT); 39 | context.setTargetRuntime("MyBatis3Simple"); 40 | context.setId("MyBatis3Simple"); 41 | context.addProperty("javaFileEncoding", "UTF-8"); 42 | context.addProperty("columnOverride", "false"); 43 | return context; 44 | } 45 | 46 | @Override 47 | protected void configureJavaClientGenerator(Context context, GeneratorProperties generatorProperties) { 48 | // disable original operation 49 | } 50 | 51 | } 52 | -------------------------------------------------------------------------------- /mybatis-r2dbc-generator/src/main/java/pro/chenggang/project/reactive/mybatis/support/generator/option/GeneratorType.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2009-2023 the original author or authors. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * https://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package pro.chenggang.project.reactive.mybatis.support.generator.option; 17 | 18 | /** 19 | * The enum Generator type. 20 | * 21 | * @author Gang Cheng 22 | * @version 1.0.0 23 | */ 24 | public enum GeneratorType { 25 | 26 | /** 27 | * dynamic sql code 28 | */ 29 | DYNAMIC, 30 | 31 | /** 32 | * simple code 33 | */ 34 | SIMPLE, 35 | 36 | /** 37 | * simple model only 38 | */ 39 | MODEL, 40 | 41 | /** 42 | * simple model and xml only 43 | */ 44 | MODEL_XML, 45 | 46 | /** 47 | * dynamic model only 48 | */ 49 | DYNAMIC_MAPPER, 50 | 51 | ; 52 | } 53 | -------------------------------------------------------------------------------- /mybatis-r2dbc-generator/src/main/java/pro/chenggang/project/reactive/mybatis/support/generator/plugin/type/GeneratedJavaTypeModifier.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2009-2023 the original author or authors. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * https://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package pro.chenggang.project.reactive.mybatis.support.generator.plugin.type; 17 | 18 | import org.mybatis.generator.api.IntrospectedColumn; 19 | import org.mybatis.generator.api.dom.java.FullyQualifiedJavaType; 20 | 21 | /** 22 | * @author Gang Cheng 23 | * @version 1.0.0 24 | * @since 1.0.0 25 | */ 26 | public interface GeneratedJavaTypeModifier { 27 | 28 | /** 29 | * Override default type 30 | * 31 | * @param column the introspected column 32 | * @param defaultType the default processed java type 33 | * @return the override java type 34 | */ 35 | FullyQualifiedJavaType overrideDefaultType(IntrospectedColumn column, FullyQualifiedJavaType defaultType); 36 | } 37 | -------------------------------------------------------------------------------- /mybatis-r2dbc-generator/src/main/java/pro/chenggang/project/reactive/mybatis/support/generator/properties/FluentGeneratorPropertiesLoader.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2009-2023 the original author or authors. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * https://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package pro.chenggang.project.reactive.mybatis.support.generator.properties; 17 | 18 | import pro.chenggang.project.reactive.mybatis.support.generator.core.MybatisDynamicCodeGenerator.Configurer; 19 | 20 | /** 21 | * @author Gang Cheng 22 | * @version 1.0.0 23 | * @since 1.0.0 24 | */ 25 | public class FluentGeneratorPropertiesLoader implements GeneratorPropertiesLoader { 26 | 27 | private final GeneratorPropertiesBuilder generatorPropertiesBuilder; 28 | 29 | public FluentGeneratorPropertiesLoader(Configurer configurer) { 30 | this.generatorPropertiesBuilder = new GeneratorPropertiesBuilder(configurer); 31 | } 32 | 33 | public FluentGeneratorPropertiesLoader(GeneratorPropertiesBuilder generatorPropertiesBuilder) { 34 | this.generatorPropertiesBuilder = generatorPropertiesBuilder; 35 | } 36 | 37 | public GeneratorPropertiesBuilder getGeneratorPropertiesBuilder() { 38 | return this.generatorPropertiesBuilder; 39 | } 40 | 41 | @Override 42 | public GeneratorProperties load() { 43 | return this.generatorPropertiesBuilder.build(); 44 | } 45 | 46 | } 47 | -------------------------------------------------------------------------------- /mybatis-r2dbc-generator/src/main/java/pro/chenggang/project/reactive/mybatis/support/generator/properties/GeneratorPropertiesLoader.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2009-2023 the original author or authors. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * https://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package pro.chenggang.project.reactive.mybatis.support.generator.properties; 17 | 18 | /** 19 | * The generator properties loader 20 | * 21 | * @author Gang Cheng 22 | * @version 1.0.0 23 | * @since 1.0.0 24 | */ 25 | @FunctionalInterface 26 | public interface GeneratorPropertiesLoader { 27 | 28 | /** 29 | * Load GeneratorProperties 30 | * 31 | * @return the GeneratorProperties 32 | */ 33 | GeneratorProperties load(); 34 | } 35 | -------------------------------------------------------------------------------- /mybatis-r2dbc-generator/src/test/java/pro/chenggang/project/reactive/mybatis/support/generator/MyBatisGeneratorAction.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2009-2023 the original author or authors. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * https://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package pro.chenggang.project.reactive.mybatis.support.generator; 17 | 18 | import org.junit.jupiter.api.Test; 19 | import pro.chenggang.project.reactive.mybatis.support.generator.core.MybatisDynamicCodeGenerator; 20 | 21 | import java.io.File; 22 | 23 | /** 24 | * Mybatis generator action 25 | * 26 | * @author Gang Cheng 27 | */ 28 | public class MyBatisGeneratorAction { 29 | 30 | /** 31 | * generate through main method 32 | * 33 | * @param args args 34 | */ 35 | public static void main(String[] args) { 36 | String codeAbsoluteLocation = new File("").getAbsolutePath() + "/mybatis-r2dbc-generator"; 37 | MybatisDynamicCodeGenerator.withYamlConfiguration() 38 | .customConfigure() 39 | .configureGenerateBasePackage(codeAbsoluteLocation, "pro.chenggang.project.reactive.mybatis.support.generator") 40 | .configureGeneratedJavaTypeModifier(TestJavaTypeModifier.class) 41 | .toGenerator() 42 | .generate(); 43 | } 44 | 45 | /** 46 | * generate through test case 47 | */ 48 | @Test 49 | public void generateWithYamlWithJunitTestMethod() { 50 | MybatisDynamicCodeGenerator.withYamlConfiguration() 51 | .customConfigure() 52 | .applyGenerateBasePackageFromClass(MyBatisGeneratorAction.class) 53 | .configureGeneratedJavaTypeModifier(TestJavaTypeModifier.class) 54 | .toGenerator() 55 | .generate(); 56 | } 57 | } 58 | -------------------------------------------------------------------------------- /mybatis-r2dbc-generator/src/test/java/pro/chenggang/project/reactive/mybatis/support/generator/TestJavaTypeModifier.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2009-2023 the original author or authors. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * https://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package pro.chenggang.project.reactive.mybatis.support.generator; 17 | 18 | import org.mybatis.generator.api.IntrospectedColumn; 19 | import org.mybatis.generator.api.dom.java.FullyQualifiedJavaType; 20 | import pro.chenggang.project.reactive.mybatis.support.generator.plugin.type.GeneratedJavaTypeModifier; 21 | 22 | import java.sql.Types; 23 | 24 | /** 25 | * @author Gang Cheng 26 | * @version 1.0.0 27 | * @since 1.0.0 28 | */ 29 | public class TestJavaTypeModifier implements GeneratedJavaTypeModifier { 30 | 31 | @Override 32 | public FullyQualifiedJavaType overrideDefaultType(IntrospectedColumn column, FullyQualifiedJavaType defaultType) { 33 | if (Types.TINYINT == column.getJdbcType()) { 34 | return new FullyQualifiedJavaType(Integer.class.getName()); 35 | } 36 | return defaultType; 37 | } 38 | } 39 | -------------------------------------------------------------------------------- /mybatis-r2dbc-generator/src/test/java/pro/chenggang/project/reactive/mybatis/support/generator/entity/model/Dept.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2009-2023 the original author or authors. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * https://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package pro.chenggang.project.reactive.mybatis.support.generator.entity.model; 17 | 18 | import lombok.AllArgsConstructor; 19 | import lombok.Builder; 20 | import lombok.EqualsAndHashCode; 21 | import lombok.Getter; 22 | import lombok.NoArgsConstructor; 23 | import lombok.Setter; 24 | import lombok.ToString; 25 | import lombok.experimental.Accessors; 26 | 27 | import java.time.LocalDateTime; 28 | 29 | /** 30 | * auto generated 31 | * @author AutoGenerated 32 | */ 33 | @ToString 34 | @Getter 35 | @Setter 36 | @Accessors(chain = true) 37 | @NoArgsConstructor 38 | @AllArgsConstructor 39 | @Builder 40 | @EqualsAndHashCode 41 | public class Dept { 42 | /** 43 | * dept no 44 | */ 45 | protected Long deptNo; 46 | 47 | /** 48 | * dept name 49 | */ 50 | protected String deptName; 51 | 52 | /** 53 | * location 54 | */ 55 | protected String location; 56 | 57 | /** 58 | * create time 59 | */ 60 | protected LocalDateTime createTime; 61 | 62 | public static final String DEPT_NO = "deptNo"; 63 | 64 | public static final String DB_DEPT_NO = "dept_no"; 65 | 66 | public static final String DEPT_NAME = "deptName"; 67 | 68 | public static final String DB_DEPT_NAME = "dept_name"; 69 | 70 | public static final String LOCATION = "location"; 71 | 72 | public static final String DB_LOCATION = "location"; 73 | 74 | public static final String CREATE_TIME = "createTime"; 75 | 76 | public static final String DB_CREATE_TIME = "create_time"; 77 | } -------------------------------------------------------------------------------- /mybatis-r2dbc-generator/src/test/java/pro/chenggang/project/reactive/mybatis/support/generator/mapper/DeptMapper.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2009-2023 the original author or authors. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * https://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package pro.chenggang.project.reactive.mybatis.support.generator.mapper; 17 | 18 | import org.apache.ibatis.annotations.Mapper; 19 | import pro.chenggang.project.reactive.mybatis.support.generator.mapper.dynamic.DeptDynamicMapper; 20 | 21 | /** 22 | * auto generated 23 | * @author AutoGenerated 24 | */ 25 | @Mapper 26 | public interface DeptMapper extends DeptDynamicMapper { 27 | } -------------------------------------------------------------------------------- /mybatis-r2dbc-generator/src/test/java/pro/chenggang/project/reactive/mybatis/support/generator/mapper/EmpMapper.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2009-2023 the original author or authors. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * https://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package pro.chenggang.project.reactive.mybatis.support.generator.mapper; 17 | 18 | import org.apache.ibatis.annotations.Mapper; 19 | import pro.chenggang.project.reactive.mybatis.support.generator.mapper.dynamic.EmpDynamicMapper; 20 | 21 | /** 22 | * auto generated 23 | * @author AutoGenerated 24 | */ 25 | @Mapper 26 | public interface EmpMapper extends EmpDynamicMapper { 27 | } -------------------------------------------------------------------------------- /mybatis-r2dbc-generator/src/test/java/pro/chenggang/project/reactive/mybatis/support/generator/mapper/dynamic/DeptDynamicSqlSupport.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2009-2023 the original author or authors. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * https://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package pro.chenggang.project.reactive.mybatis.support.generator.mapper.dynamic; 17 | 18 | import org.mybatis.dynamic.sql.SqlColumn; 19 | import org.mybatis.dynamic.sql.SqlTable; 20 | 21 | import java.sql.JDBCType; 22 | import java.time.LocalDateTime; 23 | 24 | public final class DeptDynamicSqlSupport { 25 | public static final Dept dept = new Dept(); 26 | 27 | public static final SqlColumn deptNo = dept.deptNo; 28 | 29 | public static final SqlColumn deptName = dept.deptName; 30 | 31 | public static final SqlColumn location = dept.location; 32 | 33 | public static final SqlColumn createTime = dept.createTime; 34 | 35 | public static final class Dept extends SqlTable { 36 | public final SqlColumn deptNo = column("dept_no", JDBCType.BIGINT); 37 | 38 | public final SqlColumn deptName = column("dept_name", JDBCType.VARCHAR); 39 | 40 | public final SqlColumn location = column("location", JDBCType.VARCHAR); 41 | 42 | public final SqlColumn createTime = column("create_time", JDBCType.TIMESTAMP); 43 | 44 | public Dept() { 45 | super("dept"); 46 | } 47 | } 48 | } -------------------------------------------------------------------------------- /mybatis-r2dbc-generator/src/test/resources/mapper/DeptMapper.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | dept.dept_no AS dept_dept_no, 18 | dept.dept_name AS dept_dept_name, 19 | dept.location AS dept_location, 20 | dept.create_time AS dept_create_time 21 | 22 | -------------------------------------------------------------------------------- /mybatis-r2dbc-generator/src/test/resources/mapper/EmpMapper.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | emp.emp_no AS emp_emp_no, 28 | emp.emp_name AS emp_emp_name, 29 | emp.job AS emp_job, 30 | emp.manager AS emp_manager, 31 | emp.hire_date AS emp_hire_date, 32 | emp.salary AS emp_salary, 33 | emp.kpi AS emp_kpi, 34 | emp.dept_no AS emp_dept_no, 35 | emp.create_time AS emp_create_time 36 | 37 | -------------------------------------------------------------------------------- /mybatis-r2dbc-generator/src/test/resources/mybatis-generator.yml: -------------------------------------------------------------------------------- 1 | # The target generator types 2 | generatorTypes: 3 | - SIMPLE 4 | - DYNAMIC 5 | # Whether extend dynamic mapper,default is true 6 | extendDynamicMapper: true 7 | # Whether overwrite generated file,default is false 8 | overwrite: false 9 | # Whether generate returned key,default is false 10 | generateReturnedKey: true 11 | # Whether generate column comment,default is true 12 | generateComment: true 13 | # Field is final or not, default is false 14 | finalField: false 15 | # Entity field's visibility (org.mybatis.generator.api.dom.java.JavaVisibility) 16 | fieldVisibility: PROTECTED 17 | # The table name trim regex pattern 18 | # Setting '^Sys' will replace the generated table name start with Sys 19 | # tableNameTrimPattern: "" 20 | # location settings 21 | targetLocation: 22 | # The base location 23 | # baseLocation: "" 24 | # The java location 25 | javaLocation: "src/test/java" 26 | # The mapper xml location 27 | mapperXmlLocation: "src/test/resources" 28 | targetPackage: 29 | # The base package 30 | basePackage: "" 31 | # The model package 32 | modelPackage: "entity.model" 33 | # The mapper interface package 34 | mapperInterfacePackage: "mapper" 35 | # The mapper xml package 36 | mapperXmlPackage: "mapper" 37 | targetConnection: 38 | # The jdbc driver class name 39 | jdbcDriverClassName: "com.mysql.cj.jdbc.Driver" 40 | # The jdbc connection url 41 | jdbcConnectionUrl: "jdbc:mysql://127.0.0.1:3306/r2dbc?useUnicode=true&characterEncoding=utf-8&serverTimezone=Asia/Shanghai&useSSL=false" 42 | # The jdbc username 43 | username: "root" 44 | # The jdbc password 45 | password: "123456" 46 | # The lombok annotations if needed 47 | lombokAnnotations: 48 | - lombok.Getter 49 | - lombok.Setter 50 | - lombok.NoArgsConstructor 51 | - lombok.AllArgsConstructor 52 | - lombok.EqualsAndHashCode 53 | - lombok.ToString 54 | # The target table names,or "%" to generate all tables 55 | tableNames: 56 | - "%" -------------------------------------------------------------------------------- /mybatis-r2dbc-spring/src/main/java/pro/chenggang/project/reactive/mybatis/support/r2dbc/spring/annotation/R2dbcMapperScans.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2009-2023 the original author or authors. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * https://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package pro.chenggang.project.reactive.mybatis.support.r2dbc.spring.annotation; 17 | 18 | import org.springframework.context.annotation.Import; 19 | 20 | import java.lang.annotation.Documented; 21 | import java.lang.annotation.ElementType; 22 | import java.lang.annotation.Retention; 23 | import java.lang.annotation.RetentionPolicy; 24 | import java.lang.annotation.Target; 25 | 26 | /** 27 | * The Container annotation that aggregates several {@link R2dbcMapperScan} annotations. 28 | * 29 | *

30 | * Can be used natively, declaring several nested {@link R2dbcMapperScan} annotations. Can also be used in conjunction with 31 | * Java 8's support for repeatable annotations, where {@link R2dbcMapperScan} can simply be declared several times on the 32 | * same method, implicitly generating this container annotation. 33 | *

34 | * copy from original MapperScans 35 | * 36 | * @author Kazuki Shimizu 37 | * @see R2dbcMapperScan 38 | * @since 1.2.0 39 | */ 40 | @Retention(RetentionPolicy.RUNTIME) 41 | @Target(ElementType.TYPE) 42 | @Documented 43 | @Import(R2dbcMapperScannerRegistrar.R2dbcRepeatingRegistrar.class) 44 | public @interface R2dbcMapperScans { 45 | 46 | /** 47 | * R2dbcMapperScans 48 | * 49 | * @return R2dbcMapperScan 50 | */ 51 | R2dbcMapperScan[] value(); 52 | } 53 | -------------------------------------------------------------------------------- /mybatis-r2dbc-spring/src/main/java/pro/chenggang/project/reactive/mybatis/support/r2dbc/spring/configuration/AutoExclusionFilter.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2009-2023 the original author or authors. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * https://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package pro.chenggang.project.reactive.mybatis.support.r2dbc.spring.configuration; 17 | 18 | import io.r2dbc.spi.ConnectionFactory; 19 | import org.springframework.boot.autoconfigure.AutoConfigurationImportFilter; 20 | import org.springframework.boot.autoconfigure.AutoConfigurationMetadata; 21 | import org.springframework.boot.autoconfigure.condition.ConditionalOnClass; 22 | import org.springframework.context.annotation.Configuration; 23 | 24 | import java.util.HashSet; 25 | import java.util.Set; 26 | 27 | /** 28 | * exclude DataSourceAutoConfiguration in case of Datasource Configuration auto loaded 29 | * @author Gang Cheng 30 | * @version 1.0.0 31 | */ 32 | @Configuration 33 | @ConditionalOnClass(ConnectionFactory.class) 34 | public class AutoExclusionFilter implements AutoConfigurationImportFilter { 35 | 36 | private static final Set SHOULD_SKIP = new HashSet<>(); 37 | 38 | public AutoExclusionFilter() { 39 | SHOULD_SKIP.add("org.springframework.boot.autoconfigure.jdbc.DataSourceAutoConfiguration"); 40 | } 41 | 42 | @Override 43 | public boolean[] match(String[] classNames, AutoConfigurationMetadata metadata) { 44 | boolean[] matches = new boolean[classNames.length]; 45 | for(int i = 0; i< classNames.length; i++) { 46 | matches[i] = !SHOULD_SKIP.contains(classNames[i]); 47 | } 48 | return matches; 49 | } 50 | } -------------------------------------------------------------------------------- /mybatis-r2dbc-spring/src/main/java/pro/chenggang/project/reactive/mybatis/support/r2dbc/spring/executor/SpringReactiveMybatisExecutor.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2009-2023 the original author or authors. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * https://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package pro.chenggang.project.reactive.mybatis.support.r2dbc.spring.executor; 17 | 18 | import io.r2dbc.spi.Connection; 19 | import org.springframework.r2dbc.connection.ConnectionFactoryUtils; 20 | import pro.chenggang.project.reactive.mybatis.support.r2dbc.delegate.R2dbcMybatisConfiguration; 21 | import pro.chenggang.project.reactive.mybatis.support.r2dbc.executor.DefaultReactiveMybatisExecutor; 22 | import reactor.core.publisher.Mono; 23 | 24 | /** 25 | * The type Spring reactive mybatis executor. 26 | * override closeConnection with {@link ConnectionFactoryUtils} 27 | *

28 | * {@link org.springframework.r2dbc.core.DatabaseClient} 29 | * 30 | * @author Gang Cheng 31 | * @since 1.0.0 32 | */ 33 | public class SpringReactiveMybatisExecutor extends DefaultReactiveMybatisExecutor { 34 | 35 | /** 36 | * Instantiates a new Spring reactive mybatis executor. 37 | * 38 | * @param configuration the configuration 39 | */ 40 | public SpringReactiveMybatisExecutor(R2dbcMybatisConfiguration configuration) { 41 | super(configuration); 42 | } 43 | 44 | @Override 45 | protected Mono closeConnection(Connection connection) { 46 | return ConnectionFactoryUtils.currentConnectionFactory(connectionFactory) 47 | .then() 48 | .onErrorResume(Exception.class, e -> Mono.from(connection.close())); 49 | } 50 | } 51 | -------------------------------------------------------------------------------- /mybatis-r2dbc-spring/src/main/java/pro/chenggang/project/reactive/mybatis/support/r2dbc/spring/properties/R2dbcMybatisRoutingConnectionFactoryProperties.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2009-2024 the original author or authors. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * https://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package pro.chenggang.project.reactive.mybatis.support.r2dbc.spring.properties; 17 | 18 | import lombok.Getter; 19 | import lombok.Setter; 20 | import lombok.ToString; 21 | 22 | import java.util.ArrayList; 23 | import java.util.List; 24 | 25 | /** 26 | * The type R2dbc mybatis routing connection factory properties. 27 | * 28 | * @author Gang Cheng 29 | * @version 1.0.0 30 | * @since 2.0.0 31 | */ 32 | @Getter 33 | @Setter 34 | @ToString 35 | public class R2dbcMybatisRoutingConnectionFactoryProperties { 36 | 37 | public static final String PREFIX = "spring.r2dbc.mybatis.routing"; 38 | 39 | /** 40 | * Whether enable the routing connection factory configuration 41 | */ 42 | private Boolean enabled = false; 43 | 44 | /** 45 | * The r2dbc mybatis connection factory properties definitions 46 | */ 47 | private List definitions = new ArrayList<>(); 48 | } 49 | -------------------------------------------------------------------------------- /mybatis-r2dbc-spring/src/main/java/pro/chenggang/project/reactive/mybatis/support/r2dbc/spring/routing/BeanNameDynamicRoutingConnectionFactoryLoader.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2009-2024 the original author or authors. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * https://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package pro.chenggang.project.reactive.mybatis.support.r2dbc.spring.routing; 17 | 18 | import io.r2dbc.spi.ConnectionFactory; 19 | import org.springframework.beans.BeansException; 20 | import org.springframework.context.ApplicationContext; 21 | import org.springframework.context.ApplicationContextAware; 22 | 23 | import java.util.Map; 24 | 25 | /** 26 | * The dynamic routing connection factory loader load connection factories from spring's application context 27 | * 28 | * @author Gang Cheng 29 | * @version 1.0.0 30 | * @since 2.0.0 31 | */ 32 | public class BeanNameDynamicRoutingConnectionFactoryLoader implements DynamicRoutingConnectionFactoryLoader, ApplicationContextAware { 33 | 34 | private ApplicationContext applicationContext; 35 | 36 | @Override 37 | public Map load() { 38 | return applicationContext.getBeansOfType(ConnectionFactory.class); 39 | } 40 | 41 | @Override 42 | public void setApplicationContext(ApplicationContext applicationContext) throws BeansException { 43 | this.applicationContext = applicationContext; 44 | } 45 | } 46 | -------------------------------------------------------------------------------- /mybatis-r2dbc-spring/src/main/java/pro/chenggang/project/reactive/mybatis/support/r2dbc/spring/routing/DynamicRoutingConnectionFactoryLoader.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2009-2024 the original author or authors. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * https://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package pro.chenggang.project.reactive.mybatis.support.r2dbc.spring.routing; 17 | 18 | import io.r2dbc.spi.ConnectionFactory; 19 | 20 | import java.util.Map; 21 | 22 | /** 23 | * The interface Dynamic routing connection factory loader. 24 | * 25 | * @author Gang Cheng 26 | * @version 1.0.0 27 | * @since 2.0.0 28 | */ 29 | @FunctionalInterface 30 | public interface DynamicRoutingConnectionFactoryLoader { 31 | 32 | /** 33 | * Load dynamic routing connection factory. 34 | * 35 | * @return the dynamic routing connection factory map 36 | */ 37 | Map load(); 38 | } 39 | -------------------------------------------------------------------------------- /mybatis-r2dbc-spring/src/main/java/pro/chenggang/project/reactive/mybatis/support/r2dbc/spring/routing/R2dbcMybatisRoutingConnectionFactoryCustomizer.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2009-2024 the original author or authors. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * https://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | package pro.chenggang.project.reactive.mybatis.support.r2dbc.spring.routing; 18 | 19 | /** 20 | * Dynamic routing connection factory customizer 21 | * 22 | * @author Gang Cheng 23 | * @version 1.0.0 24 | * @since 1.0.0 25 | */ 26 | @FunctionalInterface 27 | public interface R2dbcMybatisRoutingConnectionFactoryCustomizer { 28 | 29 | /** 30 | * customize dynamic routing connection factory 31 | * 32 | * @param r2dbcMybatisDynamicRoutingConnectionFactory the dynamic routing connection factory 33 | */ 34 | void customize(R2dbcMybatisDynamicRoutingConnectionFactory r2dbcMybatisDynamicRoutingConnectionFactory); 35 | } 36 | -------------------------------------------------------------------------------- /mybatis-r2dbc-spring/src/main/java/pro/chenggang/project/reactive/mybatis/support/r2dbc/spring/routing/context/R2dbcMybatisDatabaseRoutingContextHolder.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2009-2024 the original author or authors. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * https://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package pro.chenggang.project.reactive.mybatis.support.r2dbc.spring.routing.context; 17 | 18 | import lombok.Value; 19 | 20 | import java.util.ArrayDeque; 21 | 22 | /** 23 | * The r2dbc mybatis database routing context holder. 24 | * 25 | * @author Gang Cheng 26 | * @version 1.0.0 27 | * @since 2.0.0 28 | */ 29 | @Value(staticConstructor = "of") 30 | public class R2dbcMybatisDatabaseRoutingContextHolder { 31 | 32 | ArrayDeque databaseRoutingKeys; 33 | 34 | } 35 | -------------------------------------------------------------------------------- /mybatis-r2dbc-spring/src/main/java/pro/chenggang/project/reactive/mybatis/support/r2dbc/spring/routing/context/R2dbcMybatisDatabaseRoutingKeyInfo.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2009-2024 the original author or authors. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * https://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package pro.chenggang.project.reactive.mybatis.support.r2dbc.spring.routing.context; 17 | 18 | import lombok.Getter; 19 | import lombok.ToString; 20 | 21 | import java.util.Objects; 22 | 23 | /** 24 | * The r2dbc mybatis database routing key info. 25 | * 26 | * @author Gang Cheng 27 | * @version 1.0.0 28 | * @since 2.0.0 29 | */ 30 | @Getter 31 | @ToString 32 | public class R2dbcMybatisDatabaseRoutingKeyInfo { 33 | 34 | private final String routingKey; 35 | 36 | private R2dbcMybatisDatabaseRoutingKeyInfo(String routingKey) { 37 | Objects.requireNonNull(routingKey, "The database routing key can not be null"); 38 | this.routingKey = routingKey; 39 | } 40 | 41 | /** 42 | * New database routing key info. 43 | * 44 | * @param routingKey the routing key 45 | * @return the database routing key info 46 | */ 47 | public static R2dbcMybatisDatabaseRoutingKeyInfo of(String routingKey) { 48 | return new R2dbcMybatisDatabaseRoutingKeyInfo(routingKey); 49 | } 50 | } -------------------------------------------------------------------------------- /mybatis-r2dbc-spring/src/main/java/pro/chenggang/project/reactive/mybatis/support/r2dbc/spring/support/ConnectionFactoryOptionsCustomizer.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2009-2023 the original author or authors. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * https://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package pro.chenggang.project.reactive.mybatis.support.r2dbc.spring.support; 17 | 18 | import io.r2dbc.spi.ConnectionFactoryOptions; 19 | 20 | /** 21 | * ConnectionFactoryOptions customizer 22 | * 23 | * @author Gang Cheng 24 | * @version 1.0.3 25 | * @since 1.0.3 26 | */ 27 | @FunctionalInterface 28 | public interface ConnectionFactoryOptionsCustomizer { 29 | 30 | /** 31 | * customize ConnectionFactoryOptions 32 | * 33 | * @param connectionFactoryOptionsBuilder the original ConnectionFactoryOptions.Builder 34 | */ 35 | void customize(ConnectionFactoryOptions.Builder connectionFactoryOptionsBuilder); 36 | } 37 | -------------------------------------------------------------------------------- /mybatis-r2dbc-spring/src/main/java/pro/chenggang/project/reactive/mybatis/support/r2dbc/spring/support/R2dbcMybatisConfigurationCustomizer.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2009-2023 the original author or authors. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * https://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package pro.chenggang.project.reactive.mybatis.support.r2dbc.spring.support; 17 | 18 | import pro.chenggang.project.reactive.mybatis.support.r2dbc.delegate.R2dbcMybatisConfiguration; 19 | 20 | /** 21 | * Callback interface that can be customized a {@link R2dbcMybatisConfiguration} object generated on auto-configuration. 22 | * 23 | * @author Gang Cheng 24 | * @since 1.0.4 25 | */ 26 | @FunctionalInterface 27 | public interface R2dbcMybatisConfigurationCustomizer { 28 | 29 | /** 30 | * Customize the given a {@link R2dbcMybatisConfiguration} object. 31 | * 32 | * @param r2dbcMybatisConfiguration the R2dbcMybatisConfiguration object to customize 33 | */ 34 | void customize(R2dbcMybatisConfiguration r2dbcMybatisConfiguration); 35 | 36 | } 37 | -------------------------------------------------------------------------------- /mybatis-r2dbc-spring/src/main/java/pro/chenggang/project/reactive/mybatis/support/r2dbc/spring/xml/NamespaceHandler.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2009-2023 the original author or authors. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * https://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package pro.chenggang.project.reactive.mybatis.support.r2dbc.spring.xml; 17 | 18 | import org.springframework.beans.factory.xml.NamespaceHandlerSupport; 19 | 20 | /** 21 | * Namespace handler for the MyBatis namespace. 22 | * 23 | * @author Lishu Luo 24 | * 25 | * @see R2dbcMapperScannerBeanDefinitionParser 26 | * @since 1.2.0 27 | */ 28 | public class NamespaceHandler extends NamespaceHandlerSupport { 29 | 30 | /** 31 | * {@inheritDoc} 32 | */ 33 | @Override 34 | public void init() { 35 | registerBeanDefinitionParser("scan", new R2dbcMapperScannerBeanDefinitionParser()); 36 | } 37 | 38 | } 39 | -------------------------------------------------------------------------------- /mybatis-r2dbc-spring/src/main/resources/META-INF/spring.factories: -------------------------------------------------------------------------------- 1 | org.springframework.boot.autoconfigure.EnableAutoConfiguration=\ 2 | pro.chenggang.project.reactive.mybatis.support.r2dbc.spring.configuration.MybatisLanguageDriverAutoConfiguration,\ 3 | pro.chenggang.project.reactive.mybatis.support.r2dbc.spring.configuration.routing.R2dbcMybatisMultiConnectionFactoryAutoInitializer,\ 4 | pro.chenggang.project.reactive.mybatis.support.r2dbc.spring.configuration.R2dbcMybatisAutoConfiguration,\ 5 | pro.chenggang.project.reactive.mybatis.support.r2dbc.spring.configuration.routing.R2dbcMybatisRoutingAutoConfiguration 6 | org.springframework.boot.autoconfigure.AutoConfigurationImportFilter=\ 7 | pro.chenggang.project.reactive.mybatis.support.r2dbc.spring.configuration.AutoExclusionFilter 8 | -------------------------------------------------------------------------------- /mybatis-r2dbc-spring/src/main/resources/META-INF/spring.handlers: -------------------------------------------------------------------------------- 1 | http\://mybatis.org/schema/mybatis-spring=pro.chenggang.project.reactive.mybatis.support.r2dbc.spring.xml.NamespaceHandler 2 | -------------------------------------------------------------------------------- /mybatis-r2dbc-spring/src/main/resources/META-INF/spring.schemas: -------------------------------------------------------------------------------- 1 | http\://mybatis.org/schema/mybatis-spring-1.2.xsd=pro/chenggang/project/reactive/mybatis/support/r2dbc/spring/xml/mybatis-spring.xsd 2 | http\://mybatis.org/schema/mybatis-spring.xsd=pro/chenggang/project/reactive/mybatis/support/r2dbc/spring/xml/mybatis-spring.xsd -------------------------------------------------------------------------------- /mybatis-r2dbc-spring/src/main/resources/META-INF/spring/org.springframework.boot.autoconfigure.AutoConfiguration.imports: -------------------------------------------------------------------------------- 1 | pro.chenggang.project.reactive.mybatis.support.r2dbc.spring.configuration.AutoExclusionFilter 2 | pro.chenggang.project.reactive.mybatis.support.r2dbc.spring.configuration.MybatisLanguageDriverAutoConfiguration 3 | pro.chenggang.project.reactive.mybatis.support.r2dbc.spring.configuration.routing.R2dbcMybatisRoutingAutoConfiguration 4 | pro.chenggang.project.reactive.mybatis.support.r2dbc.spring.configuration.routing.R2dbcMybatisMultiConnectionFactoryAutoInitializer 5 | pro.chenggang.project.reactive.mybatis.support.r2dbc.spring.configuration.R2dbcMybatisAutoConfiguration 6 | -------------------------------------------------------------------------------- /mybatis-r2dbc-spring/src/test/java/pro/chenggang/project/reactive/mybatis/support/r2dbc/spring/application/MybatisR2dbcApplication.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2009-2024 the original author or authors. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * https://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package pro.chenggang.project.reactive.mybatis.support.r2dbc.spring.application; 17 | 18 | import org.springframework.boot.SpringApplication; 19 | import org.springframework.boot.autoconfigure.SpringBootApplication; 20 | import pro.chenggang.project.reactive.mybatis.support.r2dbc.spring.annotation.R2dbcMapperScan; 21 | 22 | /** 23 | * @author Gang Cheng 24 | */ 25 | @R2dbcMapperScan(basePackages = { 26 | "pro.chenggang.project.reactive.mybatis.support.r2dbc.spring.application.mapper", 27 | "pro.chenggang.project.reactive.mybatis.support.r2dbc.spring.common.mapper" 28 | }) 29 | @SpringBootApplication 30 | public class MybatisR2dbcApplication { 31 | 32 | public static void main(String[] args) { 33 | SpringApplication.run(MybatisR2dbcApplication.class, args); 34 | } 35 | } 36 | -------------------------------------------------------------------------------- /mybatis-r2dbc-spring/src/test/java/pro/chenggang/project/reactive/mybatis/support/r2dbc/spring/application/configuration/ApplicationConfiguration.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2009-2024 the original author or authors. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * https://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package pro.chenggang.project.reactive.mybatis.support.r2dbc.spring.application.configuration; 17 | 18 | import org.springframework.context.annotation.Bean; 19 | import org.springframework.context.annotation.Configuration; 20 | import pro.chenggang.project.reactive.mybatis.support.r2dbc.mapping.R2dbcDatabaseIdProvider; 21 | import pro.chenggang.project.reactive.mybatis.support.r2dbc.mapping.R2dbcVendorDatabaseIdProvider; 22 | import pro.chenggang.project.reactive.mybatis.support.r2dbc.spring.properties.R2dbcMybatisProperties; 23 | 24 | /** 25 | * @author Gang Cheng 26 | * @version 1.0.0 27 | * @since 1.0.0 28 | */ 29 | @Configuration 30 | public class ApplicationConfiguration { 31 | 32 | @Bean 33 | public R2dbcDatabaseIdProvider r2dbcDatabaseIdProvider(R2dbcMybatisProperties r2dbcMybatisProperties){ 34 | R2dbcVendorDatabaseIdProvider r2dbcVendorDatabaseIdProvider = new R2dbcVendorDatabaseIdProvider(); 35 | r2dbcVendorDatabaseIdProvider.setProperties(r2dbcMybatisProperties.getConfigurationProperties()); 36 | return r2dbcVendorDatabaseIdProvider; 37 | } 38 | } 39 | -------------------------------------------------------------------------------- /mybatis-r2dbc-spring/src/test/java/pro/chenggang/project/reactive/mybatis/support/r2dbc/spring/application/mapper/query/dynamic/DynamicQueryMapper.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2009-2024 the original author or authors. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * https://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package pro.chenggang.project.reactive.mybatis.support.r2dbc.spring.application.mapper.query.dynamic; 17 | 18 | import org.apache.ibatis.annotations.Mapper; 19 | import pro.chenggang.project.reactive.mybatis.support.r2dbc.dynamic.CommonCountMapper; 20 | import pro.chenggang.project.reactive.mybatis.support.r2dbc.dynamic.CommonSelectMapper; 21 | import pro.chenggang.project.reactive.mybatis.support.r2dbc.spring.common.entity.Dept; 22 | import pro.chenggang.project.reactive.mybatis.support.r2dbc.spring.common.mapper.dynamic.DeptDynamicMapper; 23 | import pro.chenggang.project.reactive.mybatis.support.r2dbc.spring.common.mapper.dynamic.DeptDynamicSqlSupport; 24 | import reactor.core.publisher.Flux; 25 | import reactor.core.publisher.Mono; 26 | 27 | import static org.mybatis.dynamic.sql.SqlBuilder.isEqualTo; 28 | 29 | /** 30 | * @author Gang Cheng 31 | * @version 1.0.0 32 | * @since 1.0.0 33 | */ 34 | @Mapper 35 | public interface DynamicQueryMapper extends CommonCountMapper, CommonSelectMapper, DeptDynamicMapper { 36 | 37 | default Mono countAllDept() { 38 | return count(dsl -> dsl); 39 | } 40 | 41 | default Mono selectByDeptNo(Long deptNo) { 42 | return selectOne(dsl -> dsl 43 | .where(DeptDynamicSqlSupport.deptNo, isEqualTo(deptNo)) 44 | ); 45 | } 46 | 47 | default Flux selectAllDept() { 48 | return select(dsl -> dsl); 49 | } 50 | 51 | } 52 | -------------------------------------------------------------------------------- /mybatis-r2dbc-spring/src/test/java/pro/chenggang/project/reactive/mybatis/support/r2dbc/spring/application/mapper/query/many/ManyQueryMapper.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2009-2024 the original author or authors. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * https://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package pro.chenggang.project.reactive.mybatis.support.r2dbc.spring.application.mapper.query.many; 17 | 18 | import org.apache.ibatis.annotations.Mapper; 19 | import org.apache.ibatis.annotations.Param; 20 | import pro.chenggang.project.reactive.mybatis.support.r2dbc.spring.common.entity.Dept; 21 | import pro.chenggang.project.reactive.mybatis.support.r2dbc.spring.common.entity.Emp; 22 | import pro.chenggang.project.reactive.mybatis.support.r2dbc.spring.common.entity.extend.DeptWithEmpList; 23 | import pro.chenggang.project.reactive.mybatis.support.r2dbc.spring.common.entity.extend.EmpWithDept; 24 | import reactor.core.publisher.Flux; 25 | 26 | /** 27 | * @author Gang Cheng 28 | * @version 1.0.0 29 | * @since 1.0.0 30 | */ 31 | @Mapper 32 | public interface ManyQueryMapper { 33 | 34 | Flux selectAllDept(@Param("deptName") String deptName); 35 | 36 | Flux selectAllDeptWithEmpList(); 37 | 38 | Flux selectAllDeptWithEmpListOrdered(); 39 | 40 | Flux selectAllEmpWithOrdered(@Param("empName") String empName); 41 | 42 | Flux selectAllEmpWithDept(); 43 | 44 | Flux selectAllEmpWithDeptOrdered(); 45 | 46 | } 47 | -------------------------------------------------------------------------------- /mybatis-r2dbc-spring/src/test/java/pro/chenggang/project/reactive/mybatis/support/r2dbc/spring/application/mapper/repository/SimpleQueryRepository.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2009-2024 the original author or authors. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * https://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package pro.chenggang.project.reactive.mybatis.support.r2dbc.spring.application.mapper.repository; 17 | 18 | import org.springframework.stereotype.Repository; 19 | import reactor.core.publisher.Mono; 20 | 21 | /** 22 | * @author Gang Cheng 23 | * @version 1.0.0 24 | * @since 1.0.0 25 | */ 26 | @Repository 27 | public interface SimpleQueryRepository { 28 | 29 | Mono countAllDept(); 30 | 31 | } 32 | -------------------------------------------------------------------------------- /mybatis-r2dbc-spring/src/test/java/pro/chenggang/project/reactive/mybatis/support/r2dbc/spring/application/mapper/transaction/delete/DeleteMapper.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2009-2024 the original author or authors. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * https://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package pro.chenggang.project.reactive.mybatis.support.r2dbc.spring.application.mapper.transaction.delete; 17 | 18 | import org.apache.ibatis.annotations.Delete; 19 | import org.apache.ibatis.annotations.Mapper; 20 | import pro.chenggang.project.reactive.mybatis.support.r2dbc.dynamic.CommonDeleteMapper; 21 | import pro.chenggang.project.reactive.mybatis.support.r2dbc.dynamic.ReactiveMyBatis3Utils; 22 | import pro.chenggang.project.reactive.mybatis.support.r2dbc.spring.common.mapper.dynamic.DeptDynamicSqlSupport; 23 | import reactor.core.publisher.Mono; 24 | 25 | import static org.mybatis.dynamic.sql.SqlBuilder.isEqualTo; 26 | import static pro.chenggang.project.reactive.mybatis.support.r2dbc.spring.common.mapper.dynamic.DeptDynamicSqlSupport.dept; 27 | 28 | /** 29 | * The interface Delete mapper. 30 | * 31 | * @author Gang Cheng 32 | * @version 1.0.0 33 | * @since 1.0.0 34 | */ 35 | @Mapper 36 | public interface DeleteMapper extends CommonDeleteMapper { 37 | 38 | Mono deleteByDeptNo(Long deptNo); 39 | 40 | @Delete("DELETE FROM dept WHERE dept_no = #{deptNo}") 41 | Mono deleteByDeptNoWithAnnotation(Long deptNo); 42 | 43 | default Mono deleteByDeptNoWithDynamic(Long deptNo) { 44 | return ReactiveMyBatis3Utils.deleteFrom(this::delete, 45 | dept, 46 | dsl -> dsl.where(DeptDynamicSqlSupport.deptNo, isEqualTo(deptNo)) 47 | ); 48 | } 49 | } 50 | -------------------------------------------------------------------------------- /mybatis-r2dbc-spring/src/test/java/pro/chenggang/project/reactive/mybatis/support/r2dbc/spring/application/mapper/type/adapter/AdapterMapper.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2009-2024 the original author or authors. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * https://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package pro.chenggang.project.reactive.mybatis.support.r2dbc.spring.application.mapper.type.adapter; 17 | 18 | import io.r2dbc.spi.Blob; 19 | import io.r2dbc.spi.Clob; 20 | import org.apache.ibatis.annotations.Param; 21 | import pro.chenggang.project.reactive.mybatis.support.r2dbc.spring.common.entity.SubjectContent; 22 | import reactor.core.publisher.Flux; 23 | import reactor.core.publisher.Mono; 24 | 25 | /** 26 | * @author Gang Cheng 27 | * @version 1.0.0 28 | * @since 1.0.0 29 | */ 30 | public interface AdapterMapper { 31 | 32 | Flux selectAllAStringAsBlob(); 33 | 34 | Mono selectAStringAsBlobByAString(@Param("blobContent") Blob blobContent); 35 | 36 | Flux selectAllAStringAsClob(); 37 | 38 | Mono selectAStringAsClobByAString(@Param("clobContent") Clob clobContent); 39 | 40 | Flux selectAll(); 41 | } 42 | -------------------------------------------------------------------------------- /mybatis-r2dbc-spring/src/test/java/pro/chenggang/project/reactive/mybatis/support/r2dbc/spring/application/mapper/type/basic/BasicTypeMapper.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2009-2024 the original author or authors. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * https://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package pro.chenggang.project.reactive.mybatis.support.r2dbc.spring.application.mapper.type.basic; 17 | 18 | import pro.chenggang.project.reactive.mybatis.support.r2dbc.spring.common.entity.Subject; 19 | import pro.chenggang.project.reactive.mybatis.support.r2dbc.spring.common.entity.SubjectData; 20 | import pro.chenggang.project.reactive.mybatis.support.r2dbc.spring.common.entity.extend.SubjectWithSubjectData; 21 | import reactor.core.publisher.Flux; 22 | 23 | /** 24 | * @author Gang Cheng 25 | * @version 1.0.0 26 | * @since 1.0.0 27 | */ 28 | public interface BasicTypeMapper { 29 | 30 | Flux selectAllSubject(); 31 | 32 | Flux selectAllSubjectData(); 33 | 34 | Flux selectAllSubjectWithSubjectData(); 35 | } 36 | -------------------------------------------------------------------------------- /mybatis-r2dbc-spring/src/test/java/pro/chenggang/project/reactive/mybatis/support/r2dbc/spring/application/mapper/type/enums/EnumRelatedMapper.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2009-2024 the original author or authors. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * https://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package pro.chenggang.project.reactive.mybatis.support.r2dbc.spring.application.mapper.type.enums; 17 | 18 | import org.apache.ibatis.annotations.Param; 19 | import pro.chenggang.project.reactive.mybatis.support.r2dbc.spring.common.entity.SubjectData; 20 | import pro.chenggang.project.reactive.mybatis.support.r2dbc.spring.common.option.SubjectDataAnEnum; 21 | import reactor.core.publisher.Flux; 22 | import reactor.core.publisher.Mono; 23 | 24 | /** 25 | * @author Gang Cheng 26 | * @version 1.0.0 27 | * @since 1.0.0 28 | */ 29 | public interface EnumRelatedMapper { 30 | 31 | Mono selectByAnEnum(@Param("anEnum") SubjectDataAnEnum subjectDataAnEnum); 32 | 33 | Mono selectByAnEnumOrdinal(@Param("anEnum") SubjectDataAnEnum subjectDataAnEnum); 34 | 35 | Flux selectAllAnEnum(); 36 | 37 | Flux selectAllAnIntAsAnEnumOrdinal(); 38 | 39 | Mono selectByAnEnumOrdinalSpecificEnumType(@Param("anEnum") SpecificEnumType specificEnumType); 40 | } 41 | -------------------------------------------------------------------------------- /mybatis-r2dbc-spring/src/test/java/pro/chenggang/project/reactive/mybatis/support/r2dbc/spring/application/mapper/type/enums/SpecificEnumType.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2009-2024 the original author or authors. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * https://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package pro.chenggang.project.reactive.mybatis.support.r2dbc.spring.application.mapper.type.enums; 17 | 18 | import lombok.Getter; 19 | import lombok.RequiredArgsConstructor; 20 | 21 | @RequiredArgsConstructor 22 | @Getter 23 | public enum SpecificEnumType { 24 | A(1), 25 | B(2) { 26 | @Override 27 | public String getName() { 28 | return "a"; 29 | } 30 | }, 31 | C(3), 32 | ; 33 | 34 | public String getName() { 35 | return this.name(); 36 | } 37 | 38 | private final int value; 39 | 40 | public static SpecificEnumType fromValue(int i) { 41 | for (SpecificEnumType t : values()) { 42 | if (t.value == i) { 43 | return t; 44 | } 45 | } 46 | return null; 47 | } 48 | } -------------------------------------------------------------------------------- /mybatis-r2dbc-spring/src/test/java/pro/chenggang/project/reactive/mybatis/support/r2dbc/spring/application/service/ApplicationService.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2009-2024 the original author or authors. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * https://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package pro.chenggang.project.reactive.mybatis.support.r2dbc.spring.application.service; 17 | 18 | import reactor.core.publisher.Mono; 19 | 20 | /** 21 | * @author Gang Cheng 22 | * @version 1.0.0 23 | * @since 1.0.0 24 | */ 25 | public interface ApplicationService { 26 | 27 | Mono runWithoutTransaction(); 28 | 29 | Mono runWithTransactionCommit(); 30 | 31 | Mono runWithTransactionCommitManually(); 32 | 33 | Mono runWithTransactionRollback(); 34 | 35 | Mono runWithTransactionRollbackManually(); 36 | } 37 | -------------------------------------------------------------------------------- /mybatis-r2dbc-spring/src/test/java/pro/chenggang/project/reactive/mybatis/support/r2dbc/spring/application/service/DynamicRoutingService.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2009-2024 the original author or authors. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * https://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package pro.chenggang.project.reactive.mybatis.support.r2dbc.spring.application.service; 17 | 18 | import reactor.core.publisher.Mono; 19 | 20 | /** 21 | * @author Gang Cheng 22 | * @version 1.0.0 23 | * @since 1.0.0 24 | */ 25 | public interface DynamicRoutingService { 26 | 27 | Mono runWithDynamicRoutingWithoutTransaction(); 28 | 29 | Mono runWithDynamicRoutingWithTransactionCommit(); 30 | 31 | Mono runWithDynamicRoutingWithTransactionCommitManually(); 32 | 33 | Mono runWithDynamicRoutingWithTransactionRollback(); 34 | 35 | Mono runWithDynamicRoutingWithTransactionRollbackManually(); 36 | 37 | } 38 | -------------------------------------------------------------------------------- /mybatis-r2dbc-spring/src/test/java/pro/chenggang/project/reactive/mybatis/support/r2dbc/spring/common/entity/Dept.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2009-2024 the original author or authors. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * https://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package pro.chenggang.project.reactive.mybatis.support.r2dbc.spring.common.entity; 17 | 18 | import lombok.AllArgsConstructor; 19 | import lombok.EqualsAndHashCode; 20 | import lombok.Getter; 21 | import lombok.NoArgsConstructor; 22 | import lombok.Setter; 23 | import lombok.ToString; 24 | 25 | import java.time.LocalDateTime; 26 | 27 | /** 28 | * dept 29 | * 30 | * @author AutoGenerated 31 | */ 32 | @Getter 33 | @Setter 34 | @NoArgsConstructor 35 | @AllArgsConstructor 36 | @EqualsAndHashCode 37 | @ToString 38 | public class Dept { 39 | /** 40 | * dept no 41 | */ 42 | protected Long deptNo; 43 | 44 | /** 45 | * dept name 46 | */ 47 | protected String deptName; 48 | 49 | /** 50 | * location 51 | */ 52 | protected String location; 53 | 54 | /** 55 | * create time 56 | */ 57 | protected LocalDateTime createTime; 58 | 59 | public static final String DEPT_NO = "deptNo"; 60 | 61 | public static final String DB_DEPT_NO = "dept_no"; 62 | 63 | public static final String DEPT_NAME = "deptName"; 64 | 65 | public static final String DB_DEPT_NAME = "dept_name"; 66 | 67 | public static final String LOCATION = "location"; 68 | 69 | public static final String DB_LOCATION = "location"; 70 | 71 | public static final String CREATE_TIME = "createTime"; 72 | 73 | public static final String DB_CREATE_TIME = "create_time"; 74 | } -------------------------------------------------------------------------------- /mybatis-r2dbc-spring/src/test/java/pro/chenggang/project/reactive/mybatis/support/r2dbc/spring/common/entity/SubjectContent.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2009-2024 the original author or authors. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * https://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package pro.chenggang.project.reactive.mybatis.support.r2dbc.spring.common.entity; 17 | 18 | import io.r2dbc.spi.Blob; 19 | import io.r2dbc.spi.Clob; 20 | import lombok.AllArgsConstructor; 21 | import lombok.Getter; 22 | import lombok.NoArgsConstructor; 23 | import lombok.Setter; 24 | import lombok.ToString; 25 | 26 | /** 27 | * @author Gang Cheng 28 | * @version 1.0.0 29 | * @since 1.0.0 30 | */ 31 | @Getter 32 | @Setter 33 | @ToString 34 | @NoArgsConstructor 35 | @AllArgsConstructor 36 | public class SubjectContent { 37 | 38 | protected Integer id; 39 | 40 | protected Blob blobContent; 41 | 42 | protected Clob clobContent; 43 | 44 | } 45 | -------------------------------------------------------------------------------- /mybatis-r2dbc-spring/src/test/java/pro/chenggang/project/reactive/mybatis/support/r2dbc/spring/common/entity/extend/DeptWithEmpList.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2009-2024 the original author or authors. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * https://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package pro.chenggang.project.reactive.mybatis.support.r2dbc.spring.common.entity.extend; 17 | 18 | import lombok.AllArgsConstructor; 19 | import lombok.Getter; 20 | import lombok.NoArgsConstructor; 21 | import lombok.Setter; 22 | import lombok.ToString; 23 | import pro.chenggang.project.reactive.mybatis.support.r2dbc.spring.common.entity.Emp; 24 | 25 | import java.time.LocalDateTime; 26 | import java.util.List; 27 | 28 | /** 29 | * @author Gang Cheng 30 | * @version 1.0.0 31 | * @since 1.0.0 32 | */ 33 | @Getter 34 | @Setter 35 | @ToString 36 | @NoArgsConstructor 37 | @AllArgsConstructor 38 | public class DeptWithEmpList { 39 | 40 | /** 41 | * dept no 42 | */ 43 | protected Long deptNo; 44 | 45 | /** 46 | * dept name 47 | */ 48 | protected String deptName; 49 | 50 | /** 51 | * location 52 | */ 53 | protected String location; 54 | 55 | /** 56 | * create time 57 | */ 58 | protected LocalDateTime createTime; 59 | 60 | /** 61 | * emp list 62 | */ 63 | protected List empList; 64 | } 65 | -------------------------------------------------------------------------------- /mybatis-r2dbc-spring/src/test/java/pro/chenggang/project/reactive/mybatis/support/r2dbc/spring/common/entity/extend/EmpWithDept.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2009-2024 the original author or authors. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * https://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package pro.chenggang.project.reactive.mybatis.support.r2dbc.spring.common.entity.extend; 17 | 18 | import lombok.AllArgsConstructor; 19 | import lombok.Getter; 20 | import lombok.NoArgsConstructor; 21 | import lombok.Setter; 22 | import lombok.ToString; 23 | import pro.chenggang.project.reactive.mybatis.support.r2dbc.spring.common.entity.Dept; 24 | 25 | import java.math.BigDecimal; 26 | import java.time.LocalDate; 27 | import java.time.LocalDateTime; 28 | 29 | /** 30 | * @author Gang Cheng 31 | * @version 1.0.0 32 | * @since 1.0.0 33 | */ 34 | @Getter 35 | @Setter 36 | @ToString 37 | @NoArgsConstructor 38 | @AllArgsConstructor 39 | public class EmpWithDept { 40 | 41 | /** 42 | * emp no 43 | */ 44 | protected Long empNo; 45 | 46 | /** 47 | * emp name 48 | */ 49 | protected String empName; 50 | 51 | /** 52 | * job 53 | */ 54 | protected String job; 55 | 56 | /** 57 | * manager 58 | */ 59 | protected String manager; 60 | 61 | /** 62 | * hire date 63 | */ 64 | protected LocalDate hireDate; 65 | 66 | /** 67 | * salary 68 | */ 69 | protected Integer salary; 70 | 71 | /** 72 | * kpi 73 | */ 74 | protected BigDecimal kpi; 75 | 76 | /** 77 | * dept no 78 | */ 79 | protected Long deptNo; 80 | 81 | /** 82 | * create time 83 | */ 84 | protected LocalDateTime createTime; 85 | 86 | /** 87 | * dept 88 | */ 89 | protected Dept dept; 90 | } 91 | -------------------------------------------------------------------------------- /mybatis-r2dbc-spring/src/test/java/pro/chenggang/project/reactive/mybatis/support/r2dbc/spring/common/entity/extend/SubjectWithSubjectData.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2009-2024 the original author or authors. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * https://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package pro.chenggang.project.reactive.mybatis.support.r2dbc.spring.common.entity.extend; 17 | 18 | import lombok.AllArgsConstructor; 19 | import lombok.Getter; 20 | import lombok.NoArgsConstructor; 21 | import lombok.Setter; 22 | import lombok.ToString; 23 | import pro.chenggang.project.reactive.mybatis.support.r2dbc.spring.common.entity.SubjectData; 24 | 25 | import java.time.LocalDateTime; 26 | import java.util.List; 27 | 28 | /** 29 | * auto generated 30 | * 31 | * @author AutoGenerated 32 | */ 33 | @Getter 34 | @Setter 35 | @ToString 36 | @NoArgsConstructor 37 | @AllArgsConstructor 38 | public class SubjectWithSubjectData { 39 | 40 | protected Integer id; 41 | 42 | protected String name; 43 | 44 | protected Integer age; 45 | 46 | protected Integer height; 47 | 48 | protected Integer weight; 49 | 50 | protected Boolean active; 51 | 52 | protected LocalDateTime dt; 53 | 54 | protected Long length; 55 | 56 | protected List subjectDataList; 57 | } -------------------------------------------------------------------------------- /mybatis-r2dbc-spring/src/test/java/pro/chenggang/project/reactive/mybatis/support/r2dbc/spring/common/mapper/DeptMapper.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2009-2024 the original author or authors. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * https://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package pro.chenggang.project.reactive.mybatis.support.r2dbc.spring.common.mapper; 17 | 18 | import org.apache.ibatis.annotations.Mapper; 19 | import pro.chenggang.project.reactive.mybatis.support.r2dbc.spring.common.entity.Dept; 20 | import reactor.core.publisher.Flux; 21 | import reactor.core.publisher.Mono; 22 | 23 | /** 24 | * dept mapper 25 | * 26 | * @author autoGenerated 27 | */ 28 | @Mapper 29 | public interface DeptMapper { 30 | 31 | Mono countAll(); 32 | 33 | Flux selectAll(); 34 | } -------------------------------------------------------------------------------- /mybatis-r2dbc-spring/src/test/java/pro/chenggang/project/reactive/mybatis/support/r2dbc/spring/common/mapper/EmpMapper.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2009-2024 the original author or authors. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * https://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package pro.chenggang.project.reactive.mybatis.support.r2dbc.spring.common.mapper; 17 | 18 | import org.apache.ibatis.annotations.Mapper; 19 | import pro.chenggang.project.reactive.mybatis.support.r2dbc.spring.common.entity.Emp; 20 | import reactor.core.publisher.Flux; 21 | import reactor.core.publisher.Mono; 22 | 23 | /** 24 | * emp mapper 25 | * 26 | * @author autoGenerated 27 | */ 28 | @Mapper 29 | public interface EmpMapper { 30 | 31 | Mono countAll(); 32 | 33 | Flux selectAll(); 34 | } -------------------------------------------------------------------------------- /mybatis-r2dbc-spring/src/test/java/pro/chenggang/project/reactive/mybatis/support/r2dbc/spring/common/mapper/SubjectDataMapper.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2009-2024 the original author or authors. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * https://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package pro.chenggang.project.reactive.mybatis.support.r2dbc.spring.common.mapper; 17 | 18 | import org.apache.ibatis.annotations.Mapper; 19 | 20 | /** 21 | * auto generated mapper 22 | * 23 | * @author autoGenerated 24 | */ 25 | @Mapper 26 | public interface SubjectDataMapper { 27 | } -------------------------------------------------------------------------------- /mybatis-r2dbc-spring/src/test/java/pro/chenggang/project/reactive/mybatis/support/r2dbc/spring/common/mapper/SubjectMapper.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2009-2024 the original author or authors. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * https://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package pro.chenggang.project.reactive.mybatis.support.r2dbc.spring.common.mapper; 17 | 18 | import org.apache.ibatis.annotations.Mapper; 19 | 20 | /** 21 | * auto generated mapper 22 | * 23 | * @author autoGenerated 24 | */ 25 | @Mapper 26 | public interface SubjectMapper { 27 | } -------------------------------------------------------------------------------- /mybatis-r2dbc-spring/src/test/java/pro/chenggang/project/reactive/mybatis/support/r2dbc/spring/common/option/SubjectDataAnEnum.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2009-2024 the original author or authors. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * https://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package pro.chenggang.project.reactive.mybatis.support.r2dbc.spring.common.option; 17 | 18 | /** 19 | * @author Gang Cheng 20 | * @version 1.0.0 21 | * @since 1.0.0 22 | */ 23 | public enum SubjectDataAnEnum { 24 | 25 | A, 26 | 27 | B, 28 | 29 | C, 30 | 31 | ; 32 | 33 | } 34 | -------------------------------------------------------------------------------- /mybatis-r2dbc-spring/src/test/java/pro/chenggang/project/reactive/mybatis/support/r2dbc/spring/test/config/MysqlConnectionFactoryOptionsConfigurer.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2009-2024 the original author or authors. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * https://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package pro.chenggang.project.reactive.mybatis.support.r2dbc.spring.test.config; 17 | 18 | import io.r2dbc.spi.ConnectionFactoryOptions; 19 | import io.r2dbc.spi.Option; 20 | import pro.chenggang.project.reactive.mybatis.support.r2dbc.builder.ConnectionFactoryOptionsConfigurer; 21 | 22 | import java.time.Duration; 23 | 24 | /** 25 | * @author Gang Cheng 26 | * @version 1.0.0 27 | * @since 1.0.0 28 | */ 29 | public class MysqlConnectionFactoryOptionsConfigurer implements ConnectionFactoryOptionsConfigurer { 30 | 31 | @Override 32 | public void configure(ConnectionFactoryOptions.Builder optionsBuilder) { 33 | optionsBuilder.option(Option.valueOf("connectTimeout"), Duration.ofSeconds(10)); 34 | optionsBuilder.option(Option.valueOf("sslMode"), "DISABLED"); 35 | } 36 | } 37 | -------------------------------------------------------------------------------- /mybatis-r2dbc-spring/src/test/java/pro/chenggang/project/reactive/mybatis/support/r2dbc/spring/test/config/PostgresqlConnectionFactoryOptionsConfigurer.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2009-2024 the original author or authors. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * https://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package pro.chenggang.project.reactive.mybatis.support.r2dbc.spring.test.config; 17 | 18 | import io.r2dbc.spi.ConnectionFactoryOptions; 19 | import io.r2dbc.spi.Option; 20 | import pro.chenggang.project.reactive.mybatis.support.r2dbc.builder.ConnectionFactoryOptionsConfigurer; 21 | 22 | import java.util.HashMap; 23 | import java.util.Map; 24 | 25 | /** 26 | * @author Gang Cheng 27 | * @version 1.0.0 28 | * @since 1.0.0 29 | */ 30 | public class PostgresqlConnectionFactoryOptionsConfigurer implements ConnectionFactoryOptionsConfigurer { 31 | 32 | @Override 33 | public void configure(ConnectionFactoryOptions.Builder optionsBuilder) { 34 | Map options = new HashMap<>(); 35 | options.put("lock_timeout", "10s"); 36 | optionsBuilder.option(Option.valueOf("options"), options); 37 | } 38 | } 39 | -------------------------------------------------------------------------------- /mybatis-r2dbc-spring/src/test/java/pro/chenggang/project/reactive/mybatis/support/r2dbc/spring/test/mapper/repository/SimpleQueryRepositoryTests.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2009-2024 the original author or authors. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * https://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package pro.chenggang.project.reactive.mybatis.support.r2dbc.spring.test.mapper.repository; 17 | 18 | import org.junit.jupiter.api.Test; 19 | import org.springframework.beans.factory.annotation.Autowired; 20 | import org.springframework.boot.test.context.SpringBootTest; 21 | import pro.chenggang.project.reactive.mybatis.support.r2dbc.spring.application.MybatisR2dbcApplication; 22 | import pro.chenggang.project.reactive.mybatis.support.r2dbc.spring.application.mapper.repository.SimpleQueryRepository; 23 | import pro.chenggang.project.reactive.mybatis.support.r2dbc.spring.test.MybatisR2dbcApplicationTests; 24 | import reactor.test.StepVerifier; 25 | 26 | /** 27 | * @author Gang Cheng 28 | * @version 1.0.0 29 | * @since 1.0.0 30 | */ 31 | @SpringBootTest(classes = MybatisR2dbcApplication.class) 32 | public class SimpleQueryRepositoryTests extends MybatisR2dbcApplicationTests { 33 | 34 | @Autowired 35 | SimpleQueryRepository simpleQueryRepository; 36 | 37 | @Test 38 | void countAll() { 39 | simpleQueryRepository.countAllDept() 40 | .as(StepVerifier::create) 41 | .expectNext(4L) 42 | .verifyComplete(); 43 | } 44 | 45 | } 46 | -------------------------------------------------------------------------------- /mybatis-r2dbc-spring/src/test/resources/application-routing.yml: -------------------------------------------------------------------------------- 1 | server: 2 | port: 0 3 | netty: 4 | connection-timeout: PT120S 5 | r2dbc: 6 | mybatis: 7 | mapper-locations: classpath:mapper/**/*.xml 8 | configuration-properties: 9 | "MySQL": "mysql" 10 | "MariaDB": "mariadb" 11 | "PostgreSQL": "postgresql" 12 | "[Microsoft SQL Server]": "mssql" 13 | "[Oracle Database]": "oracle" 14 | configuration: 15 | map-underscore-to-camel-case: true 16 | spring: 17 | r2dbc: 18 | mybatis: 19 | routing: 20 | enabled: true 21 | definitions: 22 | - pool: 23 | max-idle-time: PT5M 24 | validation-query: SELECT 1 25 | initial-size: 16 26 | max-size: 16 27 | acquire-retry: 3 28 | validation-depth: REMOTE 29 | max-create-connection-time: PT10S 30 | - pool: 31 | max-idle-time: PT5M 32 | validation-query: SELECT 1 33 | initial-size: 16 34 | max-size: 16 35 | acquire-retry: 3 36 | validation-depth: REMOTE 37 | max-create-connection-time: PT10S -------------------------------------------------------------------------------- /mybatis-r2dbc-spring/src/test/resources/application-standard.yml: -------------------------------------------------------------------------------- 1 | server: 2 | port: 0 3 | netty: 4 | connection-timeout: PT120S 5 | r2dbc: 6 | mybatis: 7 | mapper-locations: classpath:mapper/**/*.xml 8 | configuration-properties: 9 | "MySQL": "mysql" 10 | "MariaDB": "mariadb" 11 | "PostgreSQL": "postgresql" 12 | "[Microsoft SQL Server]": "mssql" 13 | "[Oracle Database]": "oracle" 14 | configuration: 15 | map-underscore-to-camel-case: true 16 | spring: 17 | r2dbc: 18 | mybatis: 19 | pool: 20 | max-idle-time: PT3M 21 | initial-size: 3 22 | max-size: 16 23 | acquire-retry: 3 24 | validation-depth: REMOTE 25 | max-create-connection-time: PT30S -------------------------------------------------------------------------------- /mybatis-r2dbc-spring/src/test/resources/application-xml-config.yml: -------------------------------------------------------------------------------- 1 | server: 2 | port: 0 3 | netty: 4 | connection-timeout: PT120S 5 | spring: 6 | r2dbc: 7 | mybatis: 8 | pool: 9 | max-idle-time: PT3M 10 | validation-query: SELECT 1 11 | initial-size: 3 12 | max-size: 16 13 | acquire-retry: 3 14 | validation-depth: REMOTE 15 | max-create-connection-time: PT30S -------------------------------------------------------------------------------- /mybatis-r2dbc-spring/src/test/resources/container-license-acceptance.txt: -------------------------------------------------------------------------------- 1 | mcr.microsoft.com/mssql/server:2017-CU12 -------------------------------------------------------------------------------- /mybatis-r2dbc-spring/src/test/resources/logback-spring.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | ${CONSOLE_LOG_PATTERN} 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | -------------------------------------------------------------------------------- /mybatis-r2dbc-spring/src/test/resources/mapper/repository/SimpleQueryRepository.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 8 | 9 | -------------------------------------------------------------------------------- /mybatis-r2dbc-spring/src/test/resources/mapper/transaction/delete/DeleteMapper.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | DELETE FROM dept WHERE dept_no = #{deptNo} 7 | 8 | 9 | -------------------------------------------------------------------------------- /mybatis-r2dbc-spring/src/test/resources/mapper/transaction/update/UpdateMapper.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | UPDATE dept SET dept_name = #{deptName}, location = #{location} , create_time = #{createTime} WHERE dept_no = #{deptNo} 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | UPDATE subject_content SET blob_content = #{blobContent} , clob_content = #{clobContent} WHERE id = #{id} 17 | 18 | 19 | -------------------------------------------------------------------------------- /mybatis-r2dbc-spring/src/test/resources/mapper/type/adapter/AdapterMapper.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 8 | 11 | 14 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 26 | 27 | -------------------------------------------------------------------------------- /mybatis-r2dbc-spring/src/test/resources/mapper/type/basic/BasicTypeMapper.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 8 | 11 | 19 | -------------------------------------------------------------------------------- /mybatis-r2dbc-spring/src/test/resources/mybatis-config.properties: -------------------------------------------------------------------------------- 1 | 2 | mysql.configurer=pro.chenggang.project.reactive.mybatis.support.r2dbc.spring.test.config.MysqlConnectionFactoryOptionsConfigurer 3 | postgresql.configurer=pro.chenggang.project.reactive.mybatis.support.r2dbc.spring.test.config.PostgresqlConnectionFactoryOptionsConfigurer -------------------------------------------------------------------------------- /mybatis-r2dbc/src/main/java/pro/chenggang/project/reactive/mybatis/support/r2dbc/ReactiveSqlSessionFactory.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2009-2023 the original author or authors. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * https://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package pro.chenggang.project.reactive.mybatis.support.r2dbc; 17 | 18 | import pro.chenggang.project.reactive.mybatis.support.r2dbc.defaults.ReactiveSqlSessionProfile; 19 | import pro.chenggang.project.reactive.mybatis.support.r2dbc.delegate.R2dbcMybatisConfiguration; 20 | 21 | /** 22 | * The interface Reactive sql session factory. 23 | * 24 | * @author Gang Cheng 25 | * @version 2.0.0 26 | */ 27 | public interface ReactiveSqlSessionFactory extends AutoCloseable { 28 | 29 | /** 30 | * open session 31 | * 32 | * @param reactiveSqlSessionProfile the reactive sql session profile 33 | * @return reactive sql session 34 | */ 35 | ReactiveSqlSession openSession(ReactiveSqlSessionProfile reactiveSqlSessionProfile); 36 | 37 | /** 38 | * Open session. 39 | * 40 | * @return the reactive sql session 41 | */ 42 | default ReactiveSqlSession openSession() { 43 | return openSession(ReactiveSqlSession.DEFAULT_PROFILE); 44 | } 45 | 46 | /** 47 | * get R2dbcMybatisConfiguration 48 | * 49 | * @return configuration configuration 50 | */ 51 | R2dbcMybatisConfiguration getConfiguration(); 52 | } 53 | -------------------------------------------------------------------------------- /mybatis-r2dbc/src/main/java/pro/chenggang/project/reactive/mybatis/support/r2dbc/builder/ConnectionFactoryOptionsConfigurer.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2009-2024 the original author or authors. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * https://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package pro.chenggang.project.reactive.mybatis.support.r2dbc.builder; 17 | 18 | import io.r2dbc.spi.ConnectionFactoryOptions; 19 | 20 | /** 21 | * The connection factory options configurer 22 | * 23 | * @author Gang Cheng 24 | * @version 1.0.0 25 | * @since 2.0.0 26 | */ 27 | public interface ConnectionFactoryOptionsConfigurer { 28 | 29 | /** 30 | * Configure connection factory options by builder. 31 | * 32 | * @param optionsBuilder the options builder 33 | */ 34 | void configure(ConnectionFactoryOptions.Builder optionsBuilder); 35 | } 36 | -------------------------------------------------------------------------------- /mybatis-r2dbc/src/main/java/pro/chenggang/project/reactive/mybatis/support/r2dbc/builder/ConnectionPoolConfigurationConfigurer.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2009-2024 the original author or authors. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * https://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package pro.chenggang.project.reactive.mybatis.support.r2dbc.builder; 17 | 18 | import io.r2dbc.pool.ConnectionPoolConfiguration; 19 | 20 | /** 21 | * The connection pool configuration configurer 22 | * 23 | * @author Gang Cheng 24 | * @version 1.0.0 25 | * @since 2.0.0 26 | */ 27 | public interface ConnectionPoolConfigurationConfigurer { 28 | 29 | /** 30 | * Configure connection pool configuration by builder 31 | * 32 | * @param builder the connection pool configuration builder 33 | */ 34 | void configure(ConnectionPoolConfiguration.Builder builder); 35 | } 36 | -------------------------------------------------------------------------------- /mybatis-r2dbc/src/main/java/pro/chenggang/project/reactive/mybatis/support/r2dbc/builder/R2dbcMapperMethodResolver.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2009-2023 the original author or authors. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * https://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package pro.chenggang.project.reactive.mybatis.support.r2dbc.builder; 17 | 18 | import org.apache.ibatis.builder.annotation.MethodResolver; 19 | 20 | import java.lang.reflect.Method; 21 | 22 | /** 23 | * The type R2dbc mapper method resolver. 24 | * 25 | * @author Eduardo Macarron 26 | * @author Gang Cheng 27 | */ 28 | public class R2dbcMapperMethodResolver extends MethodResolver { 29 | 30 | private final R2dbcMapperAnnotationBuilder annotationBuilder; 31 | private final Method method; 32 | 33 | /** 34 | * Instantiates a new R2dbc mapper method resolver. 35 | * 36 | * @param annotationBuilder the annotation builder 37 | * @param method the method 38 | */ 39 | public R2dbcMapperMethodResolver(R2dbcMapperAnnotationBuilder annotationBuilder, Method method) { 40 | super(annotationBuilder, method); 41 | this.annotationBuilder = annotationBuilder; 42 | this.method = method; 43 | } 44 | 45 | 46 | @Override 47 | public void resolve() { 48 | annotationBuilder.parseStatement(method); 49 | } 50 | 51 | } -------------------------------------------------------------------------------- /mybatis-r2dbc/src/main/java/pro/chenggang/project/reactive/mybatis/support/r2dbc/dynamic/CommonCountMapper.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2009-2023 the original author or authors. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * https://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package pro.chenggang.project.reactive.mybatis.support.r2dbc.dynamic; 17 | 18 | import org.apache.ibatis.annotations.SelectProvider; 19 | import org.mybatis.dynamic.sql.select.render.SelectStatementProvider; 20 | import org.mybatis.dynamic.sql.util.SqlProviderAdapter; 21 | import reactor.core.publisher.Mono; 22 | 23 | /** 24 | * This is a general purpose MyBatis mapper for count statements. Count statements are select statements that always 25 | * return a long. 26 | * 27 | *

This mapper can be injected as-is into a MyBatis configuration, or it can be extended with existing mappers. 28 | * 29 | * @author Jeff Butler 30 | */ 31 | public interface CommonCountMapper { 32 | /** 33 | * Execute a select statement that returns a long (typically a select(count(*)) statement). This mapper 34 | * assumes the statement returns a single row with a single column that cen be retrieved as a long. 35 | * 36 | * @param selectStatement the select statement 37 | * @return the long value 38 | */ 39 | @SelectProvider(type = SqlProviderAdapter.class, method = "select") 40 | Mono count(SelectStatementProvider selectStatement); 41 | } 42 | -------------------------------------------------------------------------------- /mybatis-r2dbc/src/main/java/pro/chenggang/project/reactive/mybatis/support/r2dbc/dynamic/CommonDeleteMapper.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2009-2023 the original author or authors. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * https://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package pro.chenggang.project.reactive.mybatis.support.r2dbc.dynamic; 17 | 18 | import org.apache.ibatis.annotations.DeleteProvider; 19 | import org.mybatis.dynamic.sql.delete.render.DeleteStatementProvider; 20 | import org.mybatis.dynamic.sql.util.SqlProviderAdapter; 21 | import reactor.core.publisher.Mono; 22 | 23 | /** 24 | * This is a general purpose MyBatis mapper for delete statements. 25 | * 26 | *

This mapper can be injected as-is into a MyBatis configuration, or it can be extended with existing mappers. 27 | * 28 | * @author Jeff Butler 29 | */ 30 | public interface CommonDeleteMapper { 31 | /** 32 | * Execute a delete statement. 33 | * 34 | * @param deleteStatement the delete statement 35 | * @return the number of rows affected 36 | */ 37 | @DeleteProvider(type = SqlProviderAdapter.class, method = "delete") 38 | Mono delete(DeleteStatementProvider deleteStatement); 39 | } 40 | -------------------------------------------------------------------------------- /mybatis-r2dbc/src/main/java/pro/chenggang/project/reactive/mybatis/support/r2dbc/dynamic/CommonGeneralInsertMapper.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2009-2023 the original author or authors. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * https://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package pro.chenggang.project.reactive.mybatis.support.r2dbc.dynamic; 17 | 18 | import org.apache.ibatis.annotations.InsertProvider; 19 | import org.mybatis.dynamic.sql.insert.render.GeneralInsertStatementProvider; 20 | import org.mybatis.dynamic.sql.insert.render.InsertSelectStatementProvider; 21 | import org.mybatis.dynamic.sql.util.SqlProviderAdapter; 22 | import reactor.core.publisher.Mono; 23 | 24 | /** 25 | * This is a general purpose mapper for executing various non-typed insert statements (general inserts and insert 26 | * selects). This mapper is appropriate for insert statements that do NOT expect generated keys. 27 | */ 28 | public interface CommonGeneralInsertMapper { 29 | /** 30 | * Execute an insert statement with input fields supplied directly. 31 | * 32 | * @param insertStatement 33 | * the insert statement 34 | * 35 | * @return the number of rows affected 36 | */ 37 | @InsertProvider(type = SqlProviderAdapter.class, method = "generalInsert") 38 | Mono generalInsert(GeneralInsertStatementProvider insertStatement); 39 | 40 | /** 41 | * Execute an insert statement with input fields supplied by a select statement. 42 | * 43 | * @param insertSelectStatement 44 | * the insert statement 45 | * 46 | * @return the number of rows affected 47 | */ 48 | @InsertProvider(type = SqlProviderAdapter.class, method = "insertSelect") 49 | Mono insertSelect(InsertSelectStatementProvider insertSelectStatement); 50 | } 51 | -------------------------------------------------------------------------------- /mybatis-r2dbc/src/main/java/pro/chenggang/project/reactive/mybatis/support/r2dbc/dynamic/CommonUpdateMapper.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2009-2023 the original author or authors. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * https://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package pro.chenggang.project.reactive.mybatis.support.r2dbc.dynamic; 17 | 18 | import org.apache.ibatis.annotations.UpdateProvider; 19 | import org.mybatis.dynamic.sql.update.render.UpdateStatementProvider; 20 | import org.mybatis.dynamic.sql.util.SqlProviderAdapter; 21 | import reactor.core.publisher.Mono; 22 | 23 | /** 24 | * This is a general purpose MyBatis mapper for update statements. 25 | * 26 | *

This mapper can be injected as-is into a MyBatis configuration, or it can be extended with existing mappers. 27 | * 28 | * @author Jeff Butler 29 | */ 30 | public interface CommonUpdateMapper { 31 | /** 32 | * Execute an update statement. 33 | * 34 | * @param updateStatement the update statement 35 | * @return the number of rows affected 36 | */ 37 | @UpdateProvider(type = SqlProviderAdapter.class, method = "update") 38 | Mono update(UpdateStatementProvider updateStatement); 39 | } 40 | -------------------------------------------------------------------------------- /mybatis-r2dbc/src/main/java/pro/chenggang/project/reactive/mybatis/support/r2dbc/dynamic/ToMonoIntBiFunction.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2009-2023 the original author or authors. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * https://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package pro.chenggang.project.reactive.mybatis.support.r2dbc.dynamic; 17 | 18 | import reactor.core.publisher.Mono; 19 | 20 | import java.util.function.BiFunction; 21 | 22 | /** 23 | * Represents a function that accepts two arguments and produces an int-valued 24 | * result. This is the {@code int}-producing primitive specialization for 25 | * {@link BiFunction}. 26 | * 27 | *

This is a functional interface 28 | * whose functional method is {@link #applyAsInt(Object, Object)}. 29 | * 30 | * @param the type of the first argument to the function 31 | * @param the type of the second argument to the function 32 | * 33 | * @see BiFunction 34 | * @since 1.8 35 | */ 36 | @FunctionalInterface 37 | public interface ToMonoIntBiFunction { 38 | 39 | /** 40 | * Applies this function to the given arguments. 41 | * 42 | * @param t the first function argument 43 | * @param u the second function argument 44 | * @return the function result 45 | */ 46 | Mono applyAsInt(T t, U u); 47 | } 48 | -------------------------------------------------------------------------------- /mybatis-r2dbc/src/main/java/pro/chenggang/project/reactive/mybatis/support/r2dbc/dynamic/ToMonoIntFunction.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2009-2023 the original author or authors. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * https://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package pro.chenggang.project.reactive.mybatis.support.r2dbc.dynamic; 17 | 18 | import reactor.core.publisher.Mono; 19 | 20 | import java.util.function.Function; 21 | 22 | /** 23 | * Represents a function that produces an int-valued result. This is the 24 | * {@code int}-producing primitive specialization for {@link Function}. 25 | * 26 | *

This is a functional interface 27 | * whose functional method is {@link #applyAsInt(Object)}. 28 | * 29 | * @param the type of the input to the function 30 | * 31 | * @see Function 32 | * @since 1.8 33 | */ 34 | @FunctionalInterface 35 | public interface ToMonoIntFunction { 36 | 37 | /** 38 | * Applies this function to the given argument. 39 | * 40 | * @param value the function argument 41 | * @return the function result 42 | */ 43 | Mono applyAsInt(T value); 44 | } 45 | -------------------------------------------------------------------------------- /mybatis-r2dbc/src/main/java/pro/chenggang/project/reactive/mybatis/support/r2dbc/dynamic/ToMonoLongFunction.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2009-2023 the original author or authors. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * https://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package pro.chenggang.project.reactive.mybatis.support.r2dbc.dynamic; 17 | 18 | import reactor.core.publisher.Mono; 19 | 20 | import java.util.function.Function; 21 | 22 | /** 23 | * Represents a function that produces a long-valued result. This is the 24 | * {@code long}-producing primitive specialization for {@link Function}. 25 | * 26 | *

This is a functional interface 27 | * whose functional method is {@link #applyAsLong(Object)}. 28 | * 29 | * @param the type of the input to the function 30 | * 31 | * @see Function 32 | * @since 1.8 33 | */ 34 | @FunctionalInterface 35 | public interface ToMonoLongFunction { 36 | 37 | /** 38 | * Applies this function to the given argument. 39 | * 40 | * @param value the function argument 41 | * @return the function result 42 | */ 43 | Mono applyAsLong(T value); 44 | } 45 | -------------------------------------------------------------------------------- /mybatis-r2dbc/src/main/java/pro/chenggang/project/reactive/mybatis/support/r2dbc/exception/GeneratedKeysException.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2009-2023 the original author or authors. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * https://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package pro.chenggang.project.reactive.mybatis.support.r2dbc.exception; 17 | 18 | import io.r2dbc.spi.R2dbcException; 19 | 20 | /** 21 | * The Generated keys exception. 22 | * when returnGeneratedKeys configured and keyColumn is not specific 23 | * 24 | * @author Gang Cheng 25 | * @version 1.0.0 26 | * @since 1.0.10 27 | */ 28 | public class GeneratedKeysException extends R2dbcException { 29 | 30 | private static final long serialVersionUID = -5831830868937457622L; 31 | 32 | /** 33 | * Instantiates a new Generated keys exception. 34 | * 35 | * @param reason the reason 36 | */ 37 | public GeneratedKeysException(String reason) { 38 | super(reason); 39 | } 40 | } 41 | -------------------------------------------------------------------------------- /mybatis-r2dbc/src/main/java/pro/chenggang/project/reactive/mybatis/support/r2dbc/exception/R2dbcParameterException.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2009-2023 the original author or authors. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * https://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package pro.chenggang.project.reactive.mybatis.support.r2dbc.exception; 17 | 18 | import io.r2dbc.spi.R2dbcException; 19 | 20 | /** 21 | * The type R2dbc parameter exception. 22 | * 23 | * @author Gang Cheng 24 | * @version 1.0.0 25 | */ 26 | public class R2dbcParameterException extends R2dbcException { 27 | 28 | private static final long serialVersionUID = 1600143335984067382L; 29 | 30 | /** 31 | * Instantiates a new R2dbc parameter exception. 32 | */ 33 | public R2dbcParameterException() { 34 | super(); 35 | } 36 | 37 | /** 38 | * Instantiates a new R2dbc parameter exception. 39 | * 40 | * @param reason the reason 41 | */ 42 | public R2dbcParameterException(String reason) { 43 | super(reason); 44 | } 45 | 46 | /** 47 | * Instantiates a new R2dbc parameter exception. 48 | * 49 | * @param reason the reason 50 | * @param cause the cause 51 | */ 52 | public R2dbcParameterException(String reason, Throwable cause) { 53 | super(reason, cause); 54 | } 55 | 56 | /** 57 | * Instantiates a new R2dbc parameter exception. 58 | * 59 | * @param cause the cause 60 | */ 61 | public R2dbcParameterException(Throwable cause) { 62 | super(cause); 63 | } 64 | } 65 | -------------------------------------------------------------------------------- /mybatis-r2dbc/src/main/java/pro/chenggang/project/reactive/mybatis/support/r2dbc/exception/R2dbcResultException.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2009-2023 the original author or authors. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * https://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package pro.chenggang.project.reactive.mybatis.support.r2dbc.exception; 17 | 18 | import io.r2dbc.spi.R2dbcException; 19 | 20 | /** 21 | * The type R2dbc result exception. 22 | * 23 | * @author Gang Cheng 24 | * @version 1.0.0 25 | */ 26 | public class R2dbcResultException extends R2dbcException { 27 | 28 | private static final long serialVersionUID = 7651039074018197180L; 29 | 30 | /** 31 | * Instantiates a new R2dbc result exception. 32 | */ 33 | public R2dbcResultException() { 34 | super(); 35 | } 36 | 37 | /** 38 | * Instantiates a new R2dbc result exception. 39 | * 40 | * @param reason the reason 41 | */ 42 | public R2dbcResultException(String reason) { 43 | super(reason); 44 | } 45 | 46 | /** 47 | * Instantiates a new R2dbc result exception. 48 | * 49 | * @param reason the reason 50 | * @param cause the cause 51 | */ 52 | public R2dbcResultException(String reason, Throwable cause) { 53 | super(reason, cause); 54 | } 55 | 56 | /** 57 | * Instantiates a new R2dbc result exception. 58 | * 59 | * @param cause the cause 60 | */ 61 | public R2dbcResultException(Throwable cause) { 62 | super(cause); 63 | } 64 | } 65 | -------------------------------------------------------------------------------- /mybatis-r2dbc/src/main/java/pro/chenggang/project/reactive/mybatis/support/r2dbc/executor/key/KeyGeneratorType.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2009-2023 the original author or authors. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * https://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package pro.chenggang.project.reactive.mybatis.support.r2dbc.executor.key; 17 | 18 | /** 19 | * The enum Key generator type. 20 | * 21 | * @author Gang Cheng 22 | * @version 1.0.2 23 | * @since 1.0.2 24 | */ 25 | public enum KeyGeneratorType { 26 | 27 | /** 28 | * no generated key 29 | */ 30 | NONE, 31 | 32 | /** 33 | * simple returned generated value 34 | */ 35 | SIMPLE_RETURN, 36 | 37 | /** 38 | * select key before 39 | */ 40 | SELECT_KEY_BEFORE, 41 | 42 | /** 43 | * select key after 44 | */ 45 | SELECT_KEY_AFTER, 46 | 47 | ; 48 | 49 | } 50 | -------------------------------------------------------------------------------- /mybatis-r2dbc/src/main/java/pro/chenggang/project/reactive/mybatis/support/r2dbc/executor/key/R2dbcKeyGenerator.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2009-2024 the original author or authors. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * https://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package pro.chenggang.project.reactive.mybatis.support.r2dbc.executor.key; 17 | 18 | import io.r2dbc.spi.Readable; 19 | import org.apache.ibatis.mapping.MappedStatement; 20 | import pro.chenggang.project.reactive.mybatis.support.r2dbc.executor.result.ReadableResultWrapper; 21 | import reactor.core.publisher.Mono; 22 | 23 | /** 24 | * The interface R2dbc key generator. 25 | * 26 | * @author Gang Cheng 27 | * @version 1.0.2 28 | * @since 1.0.2 29 | */ 30 | public interface R2dbcKeyGenerator { 31 | 32 | /** 33 | * Key generator type key generator type. 34 | * 35 | * @return the key generator type 36 | */ 37 | KeyGeneratorType keyGeneratorType(); 38 | 39 | /** 40 | * Process select key mono. 41 | * 42 | * @param keyGeneratorType the KeyGeneratorType 43 | * @param ms the ms 44 | * @param parameter the parameter 45 | * @return the mono 46 | */ 47 | Mono processSelectKey(KeyGeneratorType keyGeneratorType, MappedStatement ms, Object parameter); 48 | 49 | /** 50 | * Process generated key result mono. 51 | * 52 | * @param readableResultWrapper the row result wrapper 53 | * @param parameter the parameter 54 | * @return the mono 55 | */ 56 | Long processGeneratedKeyResult(ReadableResultWrapper readableResultWrapper, Object parameter); 57 | } 58 | -------------------------------------------------------------------------------- /mybatis-r2dbc/src/main/java/pro/chenggang/project/reactive/mybatis/support/r2dbc/executor/placeholder/PlaceholderDialectRegistry.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2009-2023 the original author or authors. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * https://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package pro.chenggang.project.reactive.mybatis.support.r2dbc.executor.placeholder; 17 | 18 | import io.r2dbc.spi.ConnectionMetadata; 19 | import pro.chenggang.project.reactive.mybatis.support.r2dbc.executor.support.ReactiveExecutorContextAttribute; 20 | 21 | import java.util.Optional; 22 | import java.util.Set; 23 | 24 | /** 25 | * The Placeholder dialect registry. 26 | * 27 | * @author Gang Cheng 28 | * @version 1.0.5 29 | * @since 1.0.5 30 | */ 31 | public interface PlaceholderDialectRegistry { 32 | 33 | /** 34 | * Register PlaceholderDialect 35 | * 36 | * @param placeholderDialect the placeholder dialect 37 | */ 38 | void register(PlaceholderDialect placeholderDialect); 39 | 40 | /** 41 | * Get all PlaceholderDialect type 42 | * @return all PlaceholderDialect's type set 43 | */ 44 | Set> getAllPlaceholderDialectTypes(); 45 | 46 | /** 47 | * Gets placeholder dialect. 48 | * 49 | * @param connectionMetadata the connection metadata 50 | * @param reactiveExecutorContextAttribute the reactive executor context attribute 51 | * @return the placeholder dialect 52 | */ 53 | Optional getPlaceholderDialect(ConnectionMetadata connectionMetadata, ReactiveExecutorContextAttribute reactiveExecutorContextAttribute); 54 | } 55 | -------------------------------------------------------------------------------- /mybatis-r2dbc/src/main/java/pro/chenggang/project/reactive/mybatis/support/r2dbc/executor/placeholder/PlaceholderFormatter.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2009-2023 the original author or authors. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * https://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package pro.chenggang.project.reactive.mybatis.support.r2dbc.executor.placeholder; 17 | 18 | import io.r2dbc.spi.ConnectionMetadata; 19 | import org.apache.ibatis.mapping.BoundSql; 20 | import pro.chenggang.project.reactive.mybatis.support.r2dbc.executor.support.ReactiveExecutorContextAttribute; 21 | 22 | /** 23 | * The Placeholder formatter. 24 | * 25 | * @author Gang Cheng 26 | * @version 1.0.5 27 | * @since 1.0.5 28 | */ 29 | public interface PlaceholderFormatter { 30 | 31 | /** 32 | * Replace sql placeholder string. 33 | * 34 | * @param connectionMetadata the connection metadata 35 | * @param boundSql the bound sql 36 | * @param reactiveExecutorContextAttribute the reactive executor context attribute 37 | * @return the string 38 | */ 39 | String replaceSqlPlaceholder(ConnectionMetadata connectionMetadata, BoundSql boundSql, ReactiveExecutorContextAttribute reactiveExecutorContextAttribute); 40 | } 41 | -------------------------------------------------------------------------------- /mybatis-r2dbc/src/main/java/pro/chenggang/project/reactive/mybatis/support/r2dbc/executor/placeholder/dialect/H2PlaceholderDialect.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2009-2023 the original author or authors. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * https://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package pro.chenggang.project.reactive.mybatis.support.r2dbc.executor.placeholder.dialect; 17 | 18 | /** 19 | * H2 placeholder dialect 20 | * 21 | * @author Gang Cheng 22 | * @version 1.0.5 23 | * @since 1.0.5 24 | */ 25 | public class H2PlaceholderDialect extends PostgreSQLPlaceholderDialect { 26 | 27 | /** 28 | * The dialect name 29 | */ 30 | public static final String DIALECT_NAME = "H2"; 31 | 32 | @Override 33 | public String name() { 34 | return DIALECT_NAME; 35 | } 36 | 37 | } 38 | -------------------------------------------------------------------------------- /mybatis-r2dbc/src/main/java/pro/chenggang/project/reactive/mybatis/support/r2dbc/executor/placeholder/dialect/MariaDBPlaceholderDialect.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2009-2023 the original author or authors. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * https://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package pro.chenggang.project.reactive.mybatis.support.r2dbc.executor.placeholder.dialect; 17 | 18 | import pro.chenggang.project.reactive.mybatis.support.r2dbc.executor.placeholder.PlaceholderDialect; 19 | 20 | /** 21 | * MariaDB placeholder dialect 22 | * 23 | * @author Gang Cheng 24 | * @version 1.0.5 25 | * @since 1.0.5 26 | */ 27 | public class MariaDBPlaceholderDialect implements PlaceholderDialect { 28 | 29 | /** 30 | * The dialect name. 31 | */ 32 | public static final String DIALECT_NAME = "MariaDB"; 33 | 34 | @Override 35 | public String name() { 36 | return DIALECT_NAME; 37 | } 38 | 39 | } 40 | -------------------------------------------------------------------------------- /mybatis-r2dbc/src/main/java/pro/chenggang/project/reactive/mybatis/support/r2dbc/executor/placeholder/dialect/MySQLPlaceholderDialect.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2009-2023 the original author or authors. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * https://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package pro.chenggang.project.reactive.mybatis.support.r2dbc.executor.placeholder.dialect; 17 | 18 | import pro.chenggang.project.reactive.mybatis.support.r2dbc.executor.placeholder.PlaceholderDialect; 19 | 20 | /** 21 | * MySQL placeholder dialect 22 | * 23 | * @author Gang Cheng 24 | * @version 1.0.5 25 | * @since 1.0.5 26 | */ 27 | public class MySQLPlaceholderDialect implements PlaceholderDialect { 28 | 29 | /** 30 | * The dialect name. 31 | */ 32 | public static final String DIALECT_NAME = "MySQL"; 33 | 34 | @Override 35 | public String name() { 36 | return DIALECT_NAME; 37 | } 38 | 39 | } 40 | -------------------------------------------------------------------------------- /mybatis-r2dbc/src/main/java/pro/chenggang/project/reactive/mybatis/support/r2dbc/executor/placeholder/dialect/NamePlaceholderDialect.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2009-2023 the original author or authors. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * https://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package pro.chenggang.project.reactive.mybatis.support.r2dbc.executor.placeholder.dialect; 17 | 18 | import pro.chenggang.project.reactive.mybatis.support.r2dbc.executor.placeholder.PlaceholderDialect; 19 | 20 | import java.util.Objects; 21 | import java.util.regex.Pattern; 22 | 23 | /** 24 | * Name placeholder dialect 25 | * 26 | * @author Gang Cheng 27 | * @version 1.0.5 28 | * @since 1.0.5 29 | */ 30 | public interface NamePlaceholderDialect extends PlaceholderDialect { 31 | 32 | Pattern DEFAULT_PROPERTY_NAME_PROCESS_PATTERN = Pattern.compile("\\."); 33 | 34 | @Override 35 | default boolean usingIndexMarker() { 36 | return false; 37 | } 38 | 39 | @Override 40 | default String propertyNamePostProcess(String propertyName) { 41 | if (Objects.isNull(propertyName) || propertyName.length() == 0) { 42 | return propertyName; 43 | } 44 | return DEFAULT_PROPERTY_NAME_PROCESS_PATTERN.matcher(propertyName).replaceAll("_"); 45 | } 46 | } 47 | -------------------------------------------------------------------------------- /mybatis-r2dbc/src/main/java/pro/chenggang/project/reactive/mybatis/support/r2dbc/executor/placeholder/dialect/OraclePlaceholderDialect.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2009-2024 the original author or authors. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * https://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package pro.chenggang.project.reactive.mybatis.support.r2dbc.executor.placeholder.dialect; 17 | 18 | import java.util.Objects; 19 | import java.util.regex.Pattern; 20 | 21 | /** 22 | * Oracle placeholder dialect 23 | * 24 | * @author Gang Cheng 25 | * @version 1.0.5 26 | * @since 1.0.5 27 | */ 28 | public class OraclePlaceholderDialect implements NamePlaceholderDialect { 29 | 30 | private static final Pattern PROPERTY_PATTERN = Pattern.compile("\\.|[^@:;/$\\d\\w_]"); 31 | 32 | /** 33 | * The dialect name 34 | */ 35 | public static final String DIALECT_NAME = "Oracle"; 36 | 37 | @Override 38 | public String name() { 39 | return DIALECT_NAME; 40 | } 41 | 42 | @Override 43 | public String getMarker() { 44 | return ":Or_"; 45 | } 46 | 47 | @Override 48 | public String propertyNamePostProcess(String propertyName) { 49 | if (Objects.isNull(propertyName) || propertyName.length() == 0) { 50 | return propertyName; 51 | } 52 | return PROPERTY_PATTERN.matcher(propertyName).replaceAll("_"); 53 | } 54 | 55 | } 56 | -------------------------------------------------------------------------------- /mybatis-r2dbc/src/main/java/pro/chenggang/project/reactive/mybatis/support/r2dbc/executor/placeholder/dialect/PostgreSQLPlaceholderDialect.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2009-2023 the original author or authors. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * https://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package pro.chenggang.project.reactive.mybatis.support.r2dbc.executor.placeholder.dialect; 17 | 18 | import pro.chenggang.project.reactive.mybatis.support.r2dbc.executor.placeholder.PlaceholderDialect; 19 | 20 | /** 21 | * PostgreSQL placeholder dialect 22 | * 23 | * @author Gang Cheng 24 | * @version 1.0.5 25 | * @since 1.0.5 26 | */ 27 | public class PostgreSQLPlaceholderDialect implements PlaceholderDialect { 28 | 29 | /** 30 | * The dialect name 31 | */ 32 | public static final String DIALECT_NAME = "PostgreSQL"; 33 | 34 | @Override 35 | public String name() { 36 | return DIALECT_NAME; 37 | } 38 | 39 | @Override 40 | public String getMarker() { 41 | return "$"; 42 | } 43 | 44 | @Override 45 | public int startIndex() { 46 | return 1; 47 | } 48 | } 49 | -------------------------------------------------------------------------------- /mybatis-r2dbc/src/main/java/pro/chenggang/project/reactive/mybatis/support/r2dbc/executor/placeholder/dialect/SQLServerPlaceholderDialect.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2009-2023 the original author or authors. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * https://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package pro.chenggang.project.reactive.mybatis.support.r2dbc.executor.placeholder.dialect; 17 | 18 | import java.util.Objects; 19 | import java.util.regex.Pattern; 20 | 21 | /** 22 | * Microsoft SQL Server placeholder dialect 23 | * 24 | * @author Gang Cheng 25 | * @version 1.0.5 26 | * @since 1.0.5 27 | */ 28 | public class SQLServerPlaceholderDialect implements NamePlaceholderDialect { 29 | 30 | /** 31 | * The dialect name 32 | */ 33 | public static final String DIALECT_NAME = "Microsoft SQL Server"; 34 | 35 | private static final Pattern PROPERTY_PATTERN = Pattern.compile("\\.|[^@$\\d\\w_]"); 36 | 37 | @Override 38 | public String name() { 39 | return DIALECT_NAME; 40 | } 41 | 42 | @Override 43 | public String getMarker() { 44 | // see io.r2dbc.mssql.ParametrizedMssqlStatement$PARAMETER_MATCHER 45 | // the parameter pattern is "@([\\p{Alpha}@][@$\\d\\w_]{0,127})" 46 | // in order to adapt original mybatis's parameters like "__frch_item_0.xxx" which pared from label 47 | return "@Ms_"; 48 | } 49 | 50 | @Override 51 | public String propertyNamePostProcess(String propertyName) { 52 | if (Objects.isNull(propertyName) || propertyName.length() == 0) { 53 | return propertyName; 54 | } 55 | return PROPERTY_PATTERN.matcher(propertyName).replaceAll("_"); 56 | } 57 | } 58 | -------------------------------------------------------------------------------- /mybatis-r2dbc/src/main/java/pro/chenggang/project/reactive/mybatis/support/r2dbc/executor/result/TypeHandleContext.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2009-2024 the original author or authors. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * https://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package pro.chenggang.project.reactive.mybatis.support.r2dbc.executor.result; 17 | 18 | import io.r2dbc.spi.Readable; 19 | import org.apache.ibatis.type.TypeHandler; 20 | 21 | /** 22 | * The interface Type handle context. 23 | * 24 | * @author Gang Cheng 25 | * @version 2.0.0 26 | * @since 1.0.0 27 | */ 28 | public interface TypeHandleContext { 29 | 30 | /** 31 | * Set delegated type handler 32 | * 33 | * @param targetType the target type 34 | * @param delegatedTypeHandler the delegated type handler 35 | * @param readableResultWrapper the row result wrapper 36 | */ 37 | void contextWith(Class targetType, TypeHandler delegatedTypeHandler, ReadableResultWrapper readableResultWrapper); 38 | 39 | } 40 | -------------------------------------------------------------------------------- /mybatis-r2dbc/src/main/java/pro/chenggang/project/reactive/mybatis/support/r2dbc/executor/support/ReactiveExecutorContextAttribute.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2009-2023 the original author or authors. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * https://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package pro.chenggang.project.reactive.mybatis.support.r2dbc.executor.support; 17 | 18 | import java.util.Map; 19 | import java.util.concurrent.ConcurrentHashMap; 20 | 21 | /** 22 | * Reactive executor context attribute 23 | * 24 | * @author Gang Cheng 25 | * @version 1.0.5 26 | * @since 1.0.5 27 | */ 28 | public class ReactiveExecutorContextAttribute { 29 | 30 | private final Map attribute = new ConcurrentHashMap<>(); 31 | 32 | /** 33 | * Gets attribute. 34 | * 35 | * @return the attribute 36 | */ 37 | public Map getAttribute() { 38 | return attribute; 39 | } 40 | } 41 | -------------------------------------------------------------------------------- /mybatis-r2dbc/src/main/java/pro/chenggang/project/reactive/mybatis/support/r2dbc/executor/type/converter/MybatisTypeHandlerConverter.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2009-2023 the original author or authors. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * https://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package pro.chenggang.project.reactive.mybatis.support.r2dbc.executor.type.converter; 17 | 18 | import org.apache.ibatis.type.TypeHandler; 19 | import pro.chenggang.project.reactive.mybatis.support.r2dbc.executor.type.R2dbcTypeHandlerAdapter; 20 | 21 | /** 22 | * The mybatis type handler converter 23 | * 24 | * @author Gang Cheng 25 | * @version 1.0.0 26 | * @since 2.0.0 27 | */ 28 | public interface MybatisTypeHandlerConverter { 29 | 30 | /** 31 | * Should convert original mybatis type handler. 32 | * 33 | * @param originalMybatisTypeHandler the original mybatis type handler 34 | * @return the true or false 35 | */ 36 | boolean shouldConvert(TypeHandler originalMybatisTypeHandler); 37 | 38 | /** 39 | * Convert original mybatis type handler to r2dbc type handler adapter. 40 | * 41 | * @param originalMybatisTypeHandler the original mybatis type handler 42 | * @return the r2dbc type handler adapter 43 | */ 44 | R2dbcTypeHandlerAdapter convert(TypeHandler originalMybatisTypeHandler); 45 | } 46 | -------------------------------------------------------------------------------- /mybatis-r2dbc/src/main/java/pro/chenggang/project/reactive/mybatis/support/r2dbc/executor/type/defaults/R2dbcBlobTypeHandlerAdapter.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2009-2024 the original author or authors. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * https://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package pro.chenggang.project.reactive.mybatis.support.r2dbc.executor.type.defaults; 17 | 18 | import io.r2dbc.spi.Blob; 19 | import io.r2dbc.spi.Readable; 20 | import io.r2dbc.spi.ReadableMetadata; 21 | import io.r2dbc.spi.Statement; 22 | import pro.chenggang.project.reactive.mybatis.support.r2dbc.executor.parameter.ParameterHandlerContext; 23 | import pro.chenggang.project.reactive.mybatis.support.r2dbc.executor.type.R2dbcTypeHandlerAdapter; 24 | 25 | /** 26 | * @author Gang Cheng 27 | * @version 1.0.0 28 | * @since 1.0.0 29 | */ 30 | public class R2dbcBlobTypeHandlerAdapter implements R2dbcTypeHandlerAdapter { 31 | 32 | @Override 33 | public Class adaptClazz() { 34 | return Blob.class; 35 | } 36 | 37 | @Override 38 | public void setParameter(Statement statement, ParameterHandlerContext parameterHandlerContext, Blob parameter) { 39 | statement.bind(parameterHandlerContext.getIndex(), parameter); 40 | } 41 | 42 | @Override 43 | public Blob getResult(Readable readable, ReadableMetadata readableMetadata, String columnName) { 44 | return readable.get(columnName, Blob.class); 45 | } 46 | 47 | @Override 48 | public Blob getResult(Readable readable, ReadableMetadata readableMetadata, int columnIndex) { 49 | return readable.get(columnIndex, Blob.class); 50 | } 51 | } 52 | -------------------------------------------------------------------------------- /mybatis-r2dbc/src/main/java/pro/chenggang/project/reactive/mybatis/support/r2dbc/executor/type/defaults/R2dbcClobTypeHandlerAdapter.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2009-2024 the original author or authors. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * https://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package pro.chenggang.project.reactive.mybatis.support.r2dbc.executor.type.defaults; 17 | 18 | import io.r2dbc.spi.Clob; 19 | import io.r2dbc.spi.Readable; 20 | import io.r2dbc.spi.ReadableMetadata; 21 | import io.r2dbc.spi.Statement; 22 | import pro.chenggang.project.reactive.mybatis.support.r2dbc.executor.parameter.ParameterHandlerContext; 23 | import pro.chenggang.project.reactive.mybatis.support.r2dbc.executor.type.R2dbcTypeHandlerAdapter; 24 | 25 | /** 26 | * @author Gang Cheng 27 | * @version 1.0.0 28 | * @since 1.0.0 29 | */ 30 | public class R2dbcClobTypeHandlerAdapter implements R2dbcTypeHandlerAdapter { 31 | 32 | @Override 33 | public Class adaptClazz() { 34 | return Clob.class; 35 | } 36 | 37 | @Override 38 | public void setParameter(Statement statement, ParameterHandlerContext parameterHandlerContext, Clob parameter) { 39 | statement.bind(parameterHandlerContext.getIndex(), parameter); 40 | } 41 | 42 | @Override 43 | public Clob getResult(Readable readable, ReadableMetadata readableMetadata, String columnName) { 44 | return readable.get(columnName, Clob.class); 45 | } 46 | 47 | @Override 48 | public Clob getResult(Readable readable, ReadableMetadata readableMetadata, int columnIndex) { 49 | return readable.get(columnIndex, Clob.class); 50 | } 51 | } 52 | -------------------------------------------------------------------------------- /mybatis-r2dbc/src/main/java/pro/chenggang/project/reactive/mybatis/support/r2dbc/executor/type/mapping/R2dbcTypeMappingFactory.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2009-2024 the original author or authors. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * https://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package pro.chenggang.project.reactive.mybatis.support.r2dbc.executor.type.mapping; 17 | 18 | import io.r2dbc.spi.R2dbcType; 19 | import org.apache.ibatis.type.JdbcType; 20 | 21 | /** 22 | * The r2dbc type mapping factory 23 | * 24 | * @author Gang Cheng 25 | * @version 1.0.0 26 | * @since 2.0.0 27 | */ 28 | public interface R2dbcTypeMappingFactory { 29 | 30 | /** 31 | * Register or replace JdbcType to R2dbcType 's mapping relationship. 32 | * 33 | * @param jdbcType the jdbc type 34 | * @param r2dbcType the r2dbc type 35 | */ 36 | void registerOrReplace(JdbcType jdbcType, R2dbcType r2dbcType); 37 | 38 | /** 39 | * Mapping JdbcType to R2dbcType. 40 | * 41 | * @param jdbcType the jdbc type 42 | * @return the r2dbc type could be null if no mapping exist or jdbcType is null 43 | */ 44 | R2dbcType mapping(JdbcType jdbcType); 45 | 46 | } 47 | -------------------------------------------------------------------------------- /mybatis-r2dbc/src/main/java/pro/chenggang/project/reactive/mybatis/support/r2dbc/mapping/R2dbcDatabaseIdProvider.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2009-2024 the original author or authors. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * https://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package pro.chenggang.project.reactive.mybatis.support.r2dbc.mapping; 17 | 18 | import io.r2dbc.spi.ConnectionFactory; 19 | 20 | import java.util.Properties; 21 | 22 | /** 23 | * Should return an id to identify the type of this database. That id can be used later on to build different queries 24 | * for each database type This mechanism enables supporting multiple vendors or versions 25 | * 26 | * @author Eduardo Macarron 27 | * @author Gang Cheng 28 | * @see org.apache.ibatis.mapping.DatabaseIdProvider 29 | */ 30 | public interface R2dbcDatabaseIdProvider { 31 | 32 | default void setProperties(Properties p) { 33 | // NOP 34 | } 35 | 36 | String getDatabaseId(ConnectionFactory connectionFactory); 37 | } 38 | -------------------------------------------------------------------------------- /mybatis-r2dbc/src/test/java/pro/chenggang/project/reactive/mybatis/support/common/entity/Dept.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2009-2023 the original author or authors. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * https://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package pro.chenggang.project.reactive.mybatis.support.common.entity; 17 | 18 | import lombok.AllArgsConstructor; 19 | import lombok.EqualsAndHashCode; 20 | import lombok.Getter; 21 | import lombok.NoArgsConstructor; 22 | import lombok.Setter; 23 | import lombok.ToString; 24 | 25 | import java.time.LocalDateTime; 26 | 27 | /** 28 | * dept 29 | * 30 | * @author AutoGenerated 31 | */ 32 | @Getter 33 | @Setter 34 | @NoArgsConstructor 35 | @AllArgsConstructor 36 | @EqualsAndHashCode 37 | @ToString 38 | public class Dept { 39 | /** 40 | * dept no 41 | */ 42 | protected Long deptNo; 43 | 44 | /** 45 | * dept name 46 | */ 47 | protected String deptName; 48 | 49 | /** 50 | * location 51 | */ 52 | protected String location; 53 | 54 | /** 55 | * create time 56 | */ 57 | protected LocalDateTime createTime; 58 | 59 | public static final String DEPT_NO = "deptNo"; 60 | 61 | public static final String DB_DEPT_NO = "dept_no"; 62 | 63 | public static final String DEPT_NAME = "deptName"; 64 | 65 | public static final String DB_DEPT_NAME = "dept_name"; 66 | 67 | public static final String LOCATION = "location"; 68 | 69 | public static final String DB_LOCATION = "location"; 70 | 71 | public static final String CREATE_TIME = "createTime"; 72 | 73 | public static final String DB_CREATE_TIME = "create_time"; 74 | } -------------------------------------------------------------------------------- /mybatis-r2dbc/src/test/java/pro/chenggang/project/reactive/mybatis/support/common/entity/SubjectContent.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2009-2023 the original author or authors. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * https://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package pro.chenggang.project.reactive.mybatis.support.common.entity; 17 | 18 | import io.r2dbc.spi.Blob; 19 | import io.r2dbc.spi.Clob; 20 | import lombok.AllArgsConstructor; 21 | import lombok.Getter; 22 | import lombok.NoArgsConstructor; 23 | import lombok.Setter; 24 | import lombok.ToString; 25 | 26 | /** 27 | * @author Gang Cheng 28 | * @version 1.0.0 29 | * @since 1.0.0 30 | */ 31 | @Getter 32 | @Setter 33 | @ToString 34 | @NoArgsConstructor 35 | @AllArgsConstructor 36 | public class SubjectContent { 37 | 38 | protected Integer id; 39 | 40 | protected Blob blobContent; 41 | 42 | protected Clob clobContent; 43 | 44 | } 45 | -------------------------------------------------------------------------------- /mybatis-r2dbc/src/test/java/pro/chenggang/project/reactive/mybatis/support/common/entity/extend/DeptWithEmpList.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2009-2023 the original author or authors. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * https://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package pro.chenggang.project.reactive.mybatis.support.common.entity.extend; 17 | 18 | import lombok.AllArgsConstructor; 19 | import lombok.Getter; 20 | import lombok.NoArgsConstructor; 21 | import lombok.Setter; 22 | import lombok.ToString; 23 | import pro.chenggang.project.reactive.mybatis.support.common.entity.Emp; 24 | 25 | import java.time.LocalDateTime; 26 | import java.util.List; 27 | 28 | /** 29 | * @author Gang Cheng 30 | * @version 1.0.0 31 | * @since 1.0.0 32 | */ 33 | @Getter 34 | @Setter 35 | @ToString 36 | @NoArgsConstructor 37 | @AllArgsConstructor 38 | public class DeptWithEmpList { 39 | 40 | /** 41 | * dept no 42 | */ 43 | protected Long deptNo; 44 | 45 | /** 46 | * dept name 47 | */ 48 | protected String deptName; 49 | 50 | /** 51 | * location 52 | */ 53 | protected String location; 54 | 55 | /** 56 | * create time 57 | */ 58 | protected LocalDateTime createTime; 59 | 60 | /** 61 | * emp list 62 | */ 63 | protected List empList; 64 | } 65 | -------------------------------------------------------------------------------- /mybatis-r2dbc/src/test/java/pro/chenggang/project/reactive/mybatis/support/common/entity/extend/EmpWithDept.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2009-2023 the original author or authors. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * https://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package pro.chenggang.project.reactive.mybatis.support.common.entity.extend; 17 | 18 | import lombok.AllArgsConstructor; 19 | import lombok.Getter; 20 | import lombok.NoArgsConstructor; 21 | import lombok.Setter; 22 | import lombok.ToString; 23 | import pro.chenggang.project.reactive.mybatis.support.common.entity.Dept; 24 | 25 | import java.math.BigDecimal; 26 | import java.time.LocalDate; 27 | import java.time.LocalDateTime; 28 | 29 | /** 30 | * @author Gang Cheng 31 | * @version 1.0.0 32 | * @since 1.0.0 33 | */ 34 | @Getter 35 | @Setter 36 | @ToString 37 | @NoArgsConstructor 38 | @AllArgsConstructor 39 | public class EmpWithDept { 40 | 41 | /** 42 | * emp no 43 | */ 44 | protected Long empNo; 45 | 46 | /** 47 | * emp name 48 | */ 49 | protected String empName; 50 | 51 | /** 52 | * job 53 | */ 54 | protected String job; 55 | 56 | /** 57 | * manager 58 | */ 59 | protected String manager; 60 | 61 | /** 62 | * hire date 63 | */ 64 | protected LocalDate hireDate; 65 | 66 | /** 67 | * salary 68 | */ 69 | protected Integer salary; 70 | 71 | /** 72 | * kpi 73 | */ 74 | protected BigDecimal kpi; 75 | 76 | /** 77 | * dept no 78 | */ 79 | protected Long deptNo; 80 | 81 | /** 82 | * create time 83 | */ 84 | protected LocalDateTime createTime; 85 | 86 | /** 87 | * dept 88 | */ 89 | protected Dept dept; 90 | } 91 | -------------------------------------------------------------------------------- /mybatis-r2dbc/src/test/java/pro/chenggang/project/reactive/mybatis/support/common/entity/extend/SubjectWithSubjectData.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2009-2023 the original author or authors. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * https://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package pro.chenggang.project.reactive.mybatis.support.common.entity.extend; 17 | 18 | import lombok.AllArgsConstructor; 19 | import lombok.Getter; 20 | import lombok.NoArgsConstructor; 21 | import lombok.Setter; 22 | import lombok.ToString; 23 | import pro.chenggang.project.reactive.mybatis.support.common.entity.SubjectData; 24 | 25 | import java.time.LocalDateTime; 26 | import java.util.List; 27 | 28 | /** 29 | * auto generated 30 | * 31 | * @author AutoGenerated 32 | */ 33 | @Getter 34 | @Setter 35 | @ToString 36 | @NoArgsConstructor 37 | @AllArgsConstructor 38 | public class SubjectWithSubjectData { 39 | 40 | protected Integer id; 41 | 42 | protected String name; 43 | 44 | protected Integer age; 45 | 46 | protected Integer height; 47 | 48 | protected Integer weight; 49 | 50 | protected Boolean active; 51 | 52 | protected LocalDateTime dt; 53 | 54 | protected Long length; 55 | 56 | protected List subjectDataList; 57 | } -------------------------------------------------------------------------------- /mybatis-r2dbc/src/test/java/pro/chenggang/project/reactive/mybatis/support/common/mapper/DeptMapper.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2009-2023 the original author or authors. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * https://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package pro.chenggang.project.reactive.mybatis.support.common.mapper; 17 | 18 | import org.apache.ibatis.annotations.Mapper; 19 | import pro.chenggang.project.reactive.mybatis.support.common.entity.Dept; 20 | import reactor.core.publisher.Flux; 21 | import reactor.core.publisher.Mono; 22 | 23 | /** 24 | * dept mapper 25 | * 26 | * @author autoGenerated 27 | */ 28 | @Mapper 29 | public interface DeptMapper { 30 | 31 | Mono countAll(); 32 | 33 | Flux selectAll(); 34 | } -------------------------------------------------------------------------------- /mybatis-r2dbc/src/test/java/pro/chenggang/project/reactive/mybatis/support/common/mapper/EmpMapper.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2009-2023 the original author or authors. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * https://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package pro.chenggang.project.reactive.mybatis.support.common.mapper; 17 | 18 | import org.apache.ibatis.annotations.Mapper; 19 | import pro.chenggang.project.reactive.mybatis.support.common.entity.Emp; 20 | import reactor.core.publisher.Flux; 21 | import reactor.core.publisher.Mono; 22 | 23 | /** 24 | * emp mapper 25 | * 26 | * @author autoGenerated 27 | */ 28 | @Mapper 29 | public interface EmpMapper { 30 | 31 | Mono countAll(); 32 | 33 | Flux selectAll(); 34 | } -------------------------------------------------------------------------------- /mybatis-r2dbc/src/test/java/pro/chenggang/project/reactive/mybatis/support/common/mapper/SubjectDataMapper.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2009-2023 the original author or authors. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * https://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package pro.chenggang.project.reactive.mybatis.support.common.mapper; 17 | 18 | import org.apache.ibatis.annotations.Mapper; 19 | 20 | /** 21 | * auto generated mapper 22 | * 23 | * @author autoGenerated 24 | */ 25 | @Mapper 26 | public interface SubjectDataMapper { 27 | } -------------------------------------------------------------------------------- /mybatis-r2dbc/src/test/java/pro/chenggang/project/reactive/mybatis/support/common/mapper/SubjectMapper.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2009-2023 the original author or authors. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * https://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package pro.chenggang.project.reactive.mybatis.support.common.mapper; 17 | 18 | import org.apache.ibatis.annotations.Mapper; 19 | 20 | /** 21 | * auto generated mapper 22 | * 23 | * @author autoGenerated 24 | */ 25 | @Mapper 26 | public interface SubjectMapper { 27 | } -------------------------------------------------------------------------------- /mybatis-r2dbc/src/test/java/pro/chenggang/project/reactive/mybatis/support/common/mapper/dynamic/DeptDynamicSqlSupport.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2009-2023 the original author or authors. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * https://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package pro.chenggang.project.reactive.mybatis.support.common.mapper.dynamic; 17 | 18 | import org.mybatis.dynamic.sql.AliasableSqlTable; 19 | import org.mybatis.dynamic.sql.SqlColumn; 20 | 21 | import java.sql.JDBCType; 22 | import java.time.LocalDateTime; 23 | 24 | /** 25 | * dept dynamic mapper 26 | * 27 | * @author autoGenerated 28 | */ 29 | public final class DeptDynamicSqlSupport { 30 | public static final Dept dept = new Dept(); 31 | 32 | /** 33 | * dept no 34 | */ 35 | public static final SqlColumn deptNo = dept.deptNo; 36 | 37 | /** 38 | * dept name 39 | */ 40 | public static final SqlColumn deptName = dept.deptName; 41 | 42 | /** 43 | * location 44 | */ 45 | public static final SqlColumn location = dept.location; 46 | 47 | /** 48 | * create time 49 | */ 50 | public static final SqlColumn createTime = dept.createTime; 51 | 52 | public static final class Dept extends AliasableSqlTable { 53 | public final SqlColumn deptNo = column("dept_no", JDBCType.BIGINT); 54 | 55 | public final SqlColumn deptName = column("dept_name", JDBCType.VARCHAR); 56 | 57 | public final SqlColumn location = column("location", JDBCType.VARCHAR); 58 | 59 | public final SqlColumn createTime = column("create_time", JDBCType.TIMESTAMP); 60 | 61 | public Dept() { 62 | super("dept", Dept::new); 63 | } 64 | } 65 | } -------------------------------------------------------------------------------- /mybatis-r2dbc/src/test/java/pro/chenggang/project/reactive/mybatis/support/common/option/SubjectDataAnEnum.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2009-2023 the original author or authors. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * https://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package pro.chenggang.project.reactive.mybatis.support.common.option; 17 | 18 | /** 19 | * @author Gang Cheng 20 | * @version 1.0.0 21 | * @since 1.0.0 22 | */ 23 | public enum SubjectDataAnEnum { 24 | 25 | A, 26 | 27 | B, 28 | 29 | C, 30 | 31 | ; 32 | 33 | } 34 | -------------------------------------------------------------------------------- /mybatis-r2dbc/src/test/java/pro/chenggang/project/reactive/mybatis/support/r2dbc/binding/MysqlConnectionFactoryOptionsConfigurer.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2009-2024 the original author or authors. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * https://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package pro.chenggang.project.reactive.mybatis.support.r2dbc.binding; 17 | 18 | import io.r2dbc.spi.ConnectionFactoryOptions; 19 | import io.r2dbc.spi.Option; 20 | import pro.chenggang.project.reactive.mybatis.support.r2dbc.builder.ConnectionFactoryOptionsConfigurer; 21 | 22 | import java.time.Duration; 23 | 24 | /** 25 | * @author Gang Cheng 26 | * @version 1.0.0 27 | * @since 2.0.0 28 | */ 29 | public class MysqlConnectionFactoryOptionsConfigurer implements ConnectionFactoryOptionsConfigurer { 30 | 31 | @Override 32 | public void configure(ConnectionFactoryOptions.Builder optionsBuilder) { 33 | optionsBuilder.option(Option.valueOf("connectTimeout"), Duration.ofSeconds(10)); 34 | optionsBuilder.option(Option.valueOf("sslMode"), "DISABLED"); 35 | } 36 | } 37 | -------------------------------------------------------------------------------- /mybatis-r2dbc/src/test/java/pro/chenggang/project/reactive/mybatis/support/r2dbc/binding/MysqlConnectionPoolConfigurationConfigurer.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2009-2024 the original author or authors. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * https://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package pro.chenggang.project.reactive.mybatis.support.r2dbc.binding; 17 | 18 | import io.r2dbc.pool.ConnectionPoolConfiguration; 19 | import io.r2dbc.pool.SimplePoolMetricsRecorder; 20 | import pro.chenggang.project.reactive.mybatis.support.r2dbc.builder.ConnectionPoolConfigurationConfigurer; 21 | 22 | /** 23 | * @author Gang Cheng 24 | * @version 1.0.0 25 | * @since 2.0.0 26 | */ 27 | public class MysqlConnectionPoolConfigurationConfigurer implements ConnectionPoolConfigurationConfigurer { 28 | 29 | @Override 30 | public void configure(ConnectionPoolConfiguration.Builder builder) { 31 | builder.metricsRecorder(new SimplePoolMetricsRecorder()); 32 | } 33 | } 34 | -------------------------------------------------------------------------------- /mybatis-r2dbc/src/test/java/pro/chenggang/project/reactive/mybatis/support/r2dbc/binding/PostgresqlConnectionFactoryOptionsConfigurer.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2009-2024 the original author or authors. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * https://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package pro.chenggang.project.reactive.mybatis.support.r2dbc.binding; 17 | 18 | import io.r2dbc.spi.ConnectionFactoryOptions; 19 | import io.r2dbc.spi.Option; 20 | import pro.chenggang.project.reactive.mybatis.support.r2dbc.builder.ConnectionFactoryOptionsConfigurer; 21 | 22 | import java.util.HashMap; 23 | import java.util.Map; 24 | 25 | /** 26 | * @author Gang Cheng 27 | * @version 1.0.0 28 | * @since 2.0.0 29 | */ 30 | public class PostgresqlConnectionFactoryOptionsConfigurer implements ConnectionFactoryOptionsConfigurer { 31 | 32 | @Override 33 | public void configure(ConnectionFactoryOptions.Builder optionsBuilder) { 34 | Map options = new HashMap<>(); 35 | options.put("lock_timeout", "10s"); 36 | optionsBuilder.option(Option.valueOf("options"), options); 37 | } 38 | } 39 | -------------------------------------------------------------------------------- /mybatis-r2dbc/src/test/java/pro/chenggang/project/reactive/mybatis/support/r2dbc/execution/procedure/ProcedureMapper.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2009-2024 the original author or authors. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * https://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package pro.chenggang.project.reactive.mybatis.support.r2dbc.execution.procedure; 17 | 18 | import org.apache.ibatis.annotations.Mapper; 19 | import org.apache.ibatis.annotations.Param; 20 | import pro.chenggang.project.reactive.mybatis.support.common.entity.Dept; 21 | import pro.chenggang.project.reactive.mybatis.support.common.entity.Emp; 22 | import reactor.core.publisher.Flux; 23 | import reactor.core.publisher.Mono; 24 | 25 | /** 26 | * @author Gang Cheng 27 | * @version 1.0.0 28 | * @since 1.0.0 29 | */ 30 | @Mapper 31 | public interface ProcedureMapper { 32 | 33 | Mono callInoutProcedureUsingUpdate(SimpleRowProcedureData simpleRowProcedureData); 34 | 35 | Mono callInoutProcedureUsingSelect(SimpleRowProcedureData simpleRowProcedureData); 36 | 37 | Mono callOutputProcedureUsingUpdate(SimpleRowProcedureData simpleRowProcedureData); 38 | 39 | Mono callOutputProcedureUsingSelect(SimpleRowProcedureData simpleRowProcedureData); 40 | 41 | Flux callOutputAndMultipleRowProcedureUsingSelect(SimpleRowProcedureData simpleRowProcedureData); 42 | 43 | Mono callSingleRowProcedureUsingSelect(SimpleRowProcedureData simpleRowProcedureData); 44 | 45 | Flux callMultipleRowProcedureUsingSelect(@Param("deptNo") Long deptNo); 46 | } 47 | -------------------------------------------------------------------------------- /mybatis-r2dbc/src/test/java/pro/chenggang/project/reactive/mybatis/support/r2dbc/execution/procedure/SimpleRowProcedureData.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2009-2024 the original author or authors. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * https://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package pro.chenggang.project.reactive.mybatis.support.r2dbc.execution.procedure; 17 | 18 | import lombok.Getter; 19 | import lombok.Setter; 20 | import lombok.ToString; 21 | 22 | /** 23 | * @author Gang Cheng 24 | * @version 1.0.0 25 | * @since 1.0.0 26 | */ 27 | @Getter 28 | @Setter 29 | @ToString 30 | public class SimpleRowProcedureData { 31 | 32 | private Long empNo; 33 | private Long deptNo; 34 | private String deptName; 35 | private String location; 36 | } 37 | -------------------------------------------------------------------------------- /mybatis-r2dbc/src/test/java/pro/chenggang/project/reactive/mybatis/support/r2dbc/execution/query/dynamic/DynamicQueryMapper.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2009-2023 the original author or authors. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * https://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package pro.chenggang.project.reactive.mybatis.support.r2dbc.execution.query.dynamic; 17 | 18 | import org.apache.ibatis.annotations.Mapper; 19 | import pro.chenggang.project.reactive.mybatis.support.common.entity.Dept; 20 | import pro.chenggang.project.reactive.mybatis.support.common.mapper.dynamic.DeptDynamicMapper; 21 | import pro.chenggang.project.reactive.mybatis.support.common.mapper.dynamic.DeptDynamicSqlSupport; 22 | import pro.chenggang.project.reactive.mybatis.support.r2dbc.dynamic.CommonCountMapper; 23 | import pro.chenggang.project.reactive.mybatis.support.r2dbc.dynamic.CommonSelectMapper; 24 | import reactor.core.publisher.Flux; 25 | import reactor.core.publisher.Mono; 26 | 27 | import static org.mybatis.dynamic.sql.SqlBuilder.isEqualTo; 28 | 29 | /** 30 | * @author Gang Cheng 31 | * @version 1.0.0 32 | * @since 1.0.0 33 | */ 34 | @Mapper 35 | public interface DynamicQueryMapper extends CommonCountMapper, CommonSelectMapper, DeptDynamicMapper { 36 | 37 | default Mono countAllDept() { 38 | return count(dsl -> dsl); 39 | } 40 | 41 | default Mono selectByDeptNo(Long deptNo) { 42 | return selectOne(dsl -> dsl 43 | .where(DeptDynamicSqlSupport.deptNo, isEqualTo(deptNo)) 44 | ); 45 | } 46 | 47 | default Flux selectAllDept() { 48 | return select(dsl -> dsl); 49 | } 50 | 51 | } 52 | -------------------------------------------------------------------------------- /mybatis-r2dbc/src/test/java/pro/chenggang/project/reactive/mybatis/support/r2dbc/execution/query/many/ManyQueryMapper.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2009-2023 the original author or authors. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * https://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package pro.chenggang.project.reactive.mybatis.support.r2dbc.execution.query.many; 17 | 18 | import org.apache.ibatis.annotations.Mapper; 19 | import org.apache.ibatis.annotations.Param; 20 | import pro.chenggang.project.reactive.mybatis.support.common.entity.Dept; 21 | import pro.chenggang.project.reactive.mybatis.support.common.entity.Emp; 22 | import pro.chenggang.project.reactive.mybatis.support.common.entity.extend.DeptWithEmpList; 23 | import pro.chenggang.project.reactive.mybatis.support.common.entity.extend.EmpWithDept; 24 | import reactor.core.publisher.Flux; 25 | 26 | /** 27 | * @author Gang Cheng 28 | * @version 1.0.0 29 | * @since 1.0.0 30 | */ 31 | @Mapper 32 | public interface ManyQueryMapper { 33 | 34 | Flux selectAllDept(@Param("deptName") String deptName); 35 | 36 | Flux selectAllDeptWithEmpList(); 37 | 38 | Flux selectAllDeptWithEmpListOrdered(); 39 | 40 | Flux selectAllEmpWithOrdered(@Param("empName") String empName); 41 | 42 | Flux selectAllEmpWithDept(); 43 | 44 | Flux selectAllEmpWithDeptOrdered(); 45 | 46 | } 47 | -------------------------------------------------------------------------------- /mybatis-r2dbc/src/test/java/pro/chenggang/project/reactive/mybatis/support/r2dbc/execution/transaction/delete/DeleteMapper.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2009-2024 the original author or authors. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * https://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package pro.chenggang.project.reactive.mybatis.support.r2dbc.execution.transaction.delete; 17 | 18 | import org.apache.ibatis.annotations.Delete; 19 | import org.apache.ibatis.annotations.Mapper; 20 | import pro.chenggang.project.reactive.mybatis.support.common.mapper.dynamic.DeptDynamicSqlSupport; 21 | import pro.chenggang.project.reactive.mybatis.support.r2dbc.dynamic.CommonDeleteMapper; 22 | import pro.chenggang.project.reactive.mybatis.support.r2dbc.dynamic.ReactiveMyBatis3Utils; 23 | import reactor.core.publisher.Mono; 24 | 25 | import static org.mybatis.dynamic.sql.SqlBuilder.isEqualTo; 26 | import static pro.chenggang.project.reactive.mybatis.support.common.mapper.dynamic.DeptDynamicSqlSupport.dept; 27 | 28 | /** 29 | * The interface Delete mapper. 30 | * 31 | * @author Gang Cheng 32 | * @version 1.0.0 33 | * @since 1.0.0 34 | */ 35 | @Mapper 36 | public interface DeleteMapper extends CommonDeleteMapper { 37 | 38 | Mono deleteByDeptNo(Long deptNo); 39 | 40 | @Delete("DELETE FROM dept WHERE dept_no = #{deptNo}") 41 | Mono deleteByDeptNoWithAnnotation(Long deptNo); 42 | 43 | default Mono deleteByDeptNoWithDynamic(Long deptNo) { 44 | return ReactiveMyBatis3Utils.deleteFrom(this::delete, 45 | dept, 46 | dsl -> dsl.where(DeptDynamicSqlSupport.deptNo, isEqualTo(deptNo)) 47 | ); 48 | } 49 | } 50 | -------------------------------------------------------------------------------- /mybatis-r2dbc/src/test/java/pro/chenggang/project/reactive/mybatis/support/r2dbc/execution/type/adapter/AdapterMapper.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2009-2023 the original author or authors. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * https://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package pro.chenggang.project.reactive.mybatis.support.r2dbc.execution.type.adapter; 17 | 18 | import io.r2dbc.spi.Blob; 19 | import io.r2dbc.spi.Clob; 20 | import org.apache.ibatis.annotations.Param; 21 | import pro.chenggang.project.reactive.mybatis.support.common.entity.SubjectContent; 22 | import reactor.core.publisher.Flux; 23 | import reactor.core.publisher.Mono; 24 | 25 | /** 26 | * @author Gang Cheng 27 | * @version 1.0.0 28 | * @since 1.0.0 29 | */ 30 | public interface AdapterMapper { 31 | 32 | Flux selectAllAStringAsBlob(); 33 | 34 | Mono selectAStringAsBlobByAString(@Param("blobContent") Blob blobContent); 35 | 36 | Flux selectAllAStringAsClob(); 37 | 38 | Mono selectAStringAsClobByAString(@Param("clobContent") Clob clobContent); 39 | 40 | Flux selectAll(); 41 | } 42 | -------------------------------------------------------------------------------- /mybatis-r2dbc/src/test/java/pro/chenggang/project/reactive/mybatis/support/r2dbc/execution/type/basic/BasicTypeMapper.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2009-2023 the original author or authors. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * https://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package pro.chenggang.project.reactive.mybatis.support.r2dbc.execution.type.basic; 17 | 18 | import pro.chenggang.project.reactive.mybatis.support.common.entity.Subject; 19 | import pro.chenggang.project.reactive.mybatis.support.common.entity.SubjectData; 20 | import pro.chenggang.project.reactive.mybatis.support.common.entity.extend.SubjectWithSubjectData; 21 | import reactor.core.publisher.Flux; 22 | 23 | /** 24 | * @author Gang Cheng 25 | * @version 1.0.0 26 | * @since 1.0.0 27 | */ 28 | public interface BasicTypeMapper { 29 | 30 | Flux selectAllSubject(); 31 | 32 | Flux selectAllSubjectData(); 33 | 34 | Flux selectAllSubjectWithSubjectData(); 35 | } 36 | -------------------------------------------------------------------------------- /mybatis-r2dbc/src/test/java/pro/chenggang/project/reactive/mybatis/support/r2dbc/execution/type/enums/EnumRelatedMapper.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2009-2023 the original author or authors. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * https://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package pro.chenggang.project.reactive.mybatis.support.r2dbc.execution.type.enums; 17 | 18 | import org.apache.ibatis.annotations.Param; 19 | import pro.chenggang.project.reactive.mybatis.support.common.entity.SubjectData; 20 | import pro.chenggang.project.reactive.mybatis.support.common.option.SubjectDataAnEnum; 21 | import reactor.core.publisher.Flux; 22 | import reactor.core.publisher.Mono; 23 | 24 | /** 25 | * @author Gang Cheng 26 | * @version 1.0.0 27 | * @since 1.0.0 28 | */ 29 | public interface EnumRelatedMapper { 30 | 31 | Mono selectByAnEnum(@Param("anEnum") SubjectDataAnEnum subjectDataAnEnum); 32 | 33 | Mono selectByAnEnumOrdinal(@Param("anEnum") SubjectDataAnEnum subjectDataAnEnum); 34 | 35 | Flux selectAllAnEnum(); 36 | 37 | Flux selectAllAnIntAsAnEnumOrdinal(); 38 | 39 | Mono selectByAnEnumOrdinalSpecificEnumType(@Param("anEnum") SpecificEnumType specificEnumType); 40 | } 41 | -------------------------------------------------------------------------------- /mybatis-r2dbc/src/test/java/pro/chenggang/project/reactive/mybatis/support/r2dbc/execution/type/enums/SpecificEnumType.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2009-2023 the original author or authors. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * https://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package pro.chenggang.project.reactive.mybatis.support.r2dbc.execution.type.enums; 17 | 18 | import lombok.Getter; 19 | import lombok.RequiredArgsConstructor; 20 | 21 | @RequiredArgsConstructor 22 | @Getter 23 | public enum SpecificEnumType { 24 | A(1), 25 | B(2) { 26 | @Override 27 | public String getName() { 28 | return "a"; 29 | } 30 | }, 31 | C(3), 32 | ; 33 | 34 | public String getName() { 35 | return this.name(); 36 | } 37 | 38 | private final int value; 39 | 40 | public static SpecificEnumType fromValue(int i) { 41 | for (SpecificEnumType t : values()) { 42 | if (t.value == i) { 43 | return t; 44 | } 45 | } 46 | return null; 47 | } 48 | } -------------------------------------------------------------------------------- /mybatis-r2dbc/src/test/java/pro/chenggang/project/reactive/mybatis/support/r2dbc/support/ProxyInstanceFactoryTest.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2009-2023 the original author or authors. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * https://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package pro.chenggang.project.reactive.mybatis.support.r2dbc.support; 17 | 18 | import org.junit.jupiter.api.Assertions; 19 | import org.junit.jupiter.api.Test; 20 | 21 | import java.lang.reflect.InvocationHandler; 22 | import java.lang.reflect.Method; 23 | 24 | /** 25 | * @author Gang Cheng 26 | * @version 1.0.0 27 | * @since 1.0.0 28 | */ 29 | class ProxyInstanceFactoryTest { 30 | 31 | @Test 32 | void newInstanceOfInterfaces() { 33 | TestInterface testInterface = ProxyInstanceFactory.newInstanceOfInterfaces( 34 | TestInterface.class, 35 | this::mockInvocationHandler 36 | ); 37 | Assertions.assertNotNull(testInterface); 38 | Assertions.assertThrowsExactly( 39 | IllegalStateException.class, 40 | () -> { 41 | TestClass testClass = ProxyInstanceFactory.newInstanceOfInterfaces( 42 | TestClass.class, 43 | this::mockInvocationHandler 44 | ); 45 | } 46 | ); 47 | } 48 | 49 | public interface TestInterface { 50 | 51 | } 52 | 53 | public class TestClass { 54 | 55 | } 56 | 57 | private InvocationHandler mockInvocationHandler() { 58 | return new InvocationHandler() { 59 | @Override 60 | public Object invoke(Object proxy, Method method, Object[] args) throws Throwable { 61 | return method.invoke(proxy, args); 62 | } 63 | }; 64 | } 65 | } -------------------------------------------------------------------------------- /mybatis-r2dbc/src/test/resources/container-license-acceptance.txt: -------------------------------------------------------------------------------- 1 | mcr.microsoft.com/mssql/server:2017-CU12 -------------------------------------------------------------------------------- /mybatis-r2dbc/src/test/resources/logback.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | ${LOG_PATTERN} 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | -------------------------------------------------------------------------------- /mybatis-r2dbc/src/test/resources/mybatis-config.properties: -------------------------------------------------------------------------------- 1 | mysql.pool.configurer=pro.chenggang.project.reactive.mybatis.support.r2dbc.binding.MysqlConnectionPoolConfigurationConfigurer 2 | mysql.configurer=pro.chenggang.project.reactive.mybatis.support.r2dbc.binding.MysqlConnectionFactoryOptionsConfigurer 3 | postgresql.configurer=pro.chenggang.project.reactive.mybatis.support.r2dbc.binding.PostgresqlConnectionFactoryOptionsConfigurer -------------------------------------------------------------------------------- /mybatis-r2dbc/src/test/resources/pro/chenggang/project/reactive/mybatis/support/r2dbc/execution/transaction/delete/DeleteMapper.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | DELETE FROM dept WHERE dept_no = #{deptNo} 7 | 8 | 9 | -------------------------------------------------------------------------------- /mybatis-r2dbc/src/test/resources/pro/chenggang/project/reactive/mybatis/support/r2dbc/execution/transaction/update/UpdateMapper.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | UPDATE dept SET dept_name = #{deptName}, location = #{location} , create_time = #{createTime} WHERE dept_no = #{deptNo} 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | UPDATE subject_content SET blob_content = #{blobContent} , clob_content = #{clobContent} WHERE id = #{id} 17 | 18 | 19 | -------------------------------------------------------------------------------- /mybatis-r2dbc/src/test/resources/pro/chenggang/project/reactive/mybatis/support/r2dbc/execution/type/adapter/AdapterMapper.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 8 | 11 | 14 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 26 | 27 | -------------------------------------------------------------------------------- /mybatis-r2dbc/src/test/resources/pro/chenggang/project/reactive/mybatis/support/r2dbc/execution/type/basic/BasicTypeMapper.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 8 | 11 | 19 | -------------------------------------------------------------------------------- /toolchains.xml: -------------------------------------------------------------------------------- 1 | 2 | 19 | 20 | 21 | 22 | jdk 23 | 24 | 8 25 | 26 | 27 | ~/.sdkman/candidates/java/8.0.392-tem 28 | 29 | 30 | 31 | jdk 32 | 33 | 11 34 | 35 | 36 | ~/.sdkman/candidates/java/11.0.18-tem 37 | 38 | 39 | 40 | jdk 41 | 42 | 17 43 | 44 | 45 | ~/.sdkman/candidates/java/17.0.6-tem 46 | 47 | 48 | 49 | 50 | --------------------------------------------------------------------------------