You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@shardingsphere.apache.org by GitBox <gi...@apache.org> on 2022/11/30 07:15:08 UTC

[GitHub] [shardingsphere] Pace2Car opened a new pull request, #22525: Refactor class-based-sharding-algorithm-example with ShardingSphereDriver

Pace2Car opened a new pull request, #22525:
URL: https://github.com/apache/shardingsphere/pull/22525

   For #22469.
   
   Changes proposed in this pull request:
     - Refactor class-based-sharding-algorithm-example with ShardingSphereDriver
     - Remove Spring configuration example
   
   ---
   
   Before committing this PR, I'm sure that I have checked the following options:
   - [x] My code follows the [code of conduct](https://shardingsphere.apache.org/community/en/involved/conduct/code/) of this project.
   - [x] I have self-reviewed the commit code.
   - [ ] I have (or in comment I request) added corresponding labels for the pull request.
   - [x] I have passed maven check locally : `./mvnw clean install -B -T1C -Dmaven.javadoc.skip -Dmaven.jacoco.skip -e`.
   - [ ] I have made corresponding changes to the documentation.
   - [ ] I have added corresponding unit tests for my changes.
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: notifications-unsubscribe@shardingsphere.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [shardingsphere] RaigorJiang commented on a diff in pull request #22525: Refactor class-based-sharding-algorithm-example with ShardingSphereDriver

Posted by GitBox <gi...@apache.org>.
RaigorJiang commented on code in PR #22525:
URL: https://github.com/apache/shardingsphere/pull/22525#discussion_r1035643112


##########
examples/shardingsphere-jdbc-example/single-feature-example/extension-example/custom-sharding-algortihm-example/spi-based-sharding-algorithm-example/spi-based-sharding-spring-boot-mybatis-example/src/main/resources/sharding-auto-tables.yaml:
##########
@@ -0,0 +1,68 @@
+#
+# Licensed to the Apache Software Foundation (ASF) under one or more
+# contributor license agreements.  See the NOTICE file distributed with
+# this work for additional information regarding copyright ownership.
+# The ASF licenses this file to You under the Apache License, Version 2.0
+# (the "License"); you may not use this file except in compliance with
+# the License.  You may obtain a copy of the License at
+#
+#     http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+#
+
+dataSources:
+  ds_0:
+    dataSourceClassName: com.zaxxer.hikari.HikariDataSource
+    driverClassName: com.mysql.jdbc.Driver
+    jdbcUrl: jdbc:mysql://localhost:3306/demo_ds_0?serverTimezone=UTC&useSSL=false&useUnicode=true&characterEncoding=UTF-8
+    username: root
+    password:
+  ds_1:
+    dataSourceClassName: com.zaxxer.hikari.HikariDataSource
+    driverClassName: com.mysql.jdbc.Driver
+    jdbcUrl: jdbc:mysql://localhost:3306/demo_ds_1?serverTimezone=UTC&useSSL=false&useUnicode=true&characterEncoding=UTF-8
+    username: root
+    password:
+
+rules:
+- !SHARDING
+  autoTables:
+    t_order:
+      actualDataSources: ds_${0..1}
+      shardingStrategy:
+        standard:
+          shardingColumn: order_id
+          shardingAlgorithmName: auto_mod
+      keyGenerateStrategy:
+        column: order_id
+        keyGeneratorName: snowflake
+    t_order_item:
+      actualDataSources: ds_${0..1}
+      shardingStrategy:
+        standard:
+          shardingColumn: order_item_id
+          shardingAlgorithmName: auto_mod
+      keyGenerateStrategy:
+        column: order_item_id
+        keyGeneratorName: snowflake
+  bindingTables:
+    - t_order,t_order_item
+  
+  shardingAlgorithms:
+    auto_mod:
+      type: mod
+      props:
+        sharding-count: 4
+    
+  

Review Comment:
   Redundant blank line.



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: notifications-unsubscribe@shardingsphere.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [shardingsphere] RaigorJiang commented on a diff in pull request #22525: Refactor class-based-sharding-algorithm-example with ShardingSphereDriver

Posted by GitBox <gi...@apache.org>.
RaigorJiang commented on code in PR #22525:
URL: https://github.com/apache/shardingsphere/pull/22525#discussion_r1035642570


##########
examples/shardingsphere-jdbc-example/single-feature-example/extension-example/custom-sharding-algortihm-example/spi-based-sharding-algorithm-example/spi-based-sharding-spring-boot-jpa-example/src/main/resources/sharding-auto-tables.yaml:
##########
@@ -0,0 +1,68 @@
+#
+# Licensed to the Apache Software Foundation (ASF) under one or more
+# contributor license agreements.  See the NOTICE file distributed with
+# this work for additional information regarding copyright ownership.
+# The ASF licenses this file to You under the Apache License, Version 2.0
+# (the "License"); you may not use this file except in compliance with
+# the License.  You may obtain a copy of the License at
+#
+#     http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+#
+
+dataSources:
+  ds_0:
+    dataSourceClassName: com.zaxxer.hikari.HikariDataSource
+    driverClassName: com.mysql.jdbc.Driver
+    jdbcUrl: jdbc:mysql://localhost:3306/demo_ds_0?serverTimezone=UTC&useSSL=false&useUnicode=true&characterEncoding=UTF_8
+    username: root
+    password:
+  ds_1:
+    dataSourceClassName: com.zaxxer.hikari.HikariDataSource
+    driverClassName: com.mysql.jdbc.Driver
+    jdbcUrl: jdbc:mysql://localhost:3306/demo_ds_1?serverTimezone=UTC&useSSL=false&useUnicode=true&characterEncoding=UTF-8
+    username: root
+    password:
+
+rules:
+- !SHARDING
+  autoTables:
+    t_order:
+      actualDataSources: ds_${0..1}
+      shardingStrategy:
+        standard:
+          shardingColumn: order_id
+          shardingAlgorithmName: auto_mod
+      keyGenerateStrategy:
+        column: order_id
+        keyGeneratorName: snowflake
+    t_order_item:
+      actualDataSources: ds_${0..1}
+      shardingStrategy:
+        standard:
+          shardingColumn: order_item_id
+          shardingAlgorithmName: auto_mod
+      keyGenerateStrategy:
+        column: order_item_id
+        keyGeneratorName: snowflake
+  bindingTables:
+    - t_order,t_order_item
+  
+  shardingAlgorithms:
+    auto_mod:
+      type: mod
+      props:
+        sharding-count: 4
+    
+  

Review Comment:
   Redundant blank line.



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: notifications-unsubscribe@shardingsphere.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [shardingsphere] codecov-commenter commented on pull request #22525: Refactor class-based-sharding-algorithm-example with ShardingSphereDriver

Posted by GitBox <gi...@apache.org>.
codecov-commenter commented on PR #22525:
URL: https://github.com/apache/shardingsphere/pull/22525#issuecomment-1331762564

   # [Codecov](https://codecov.io/gh/apache/shardingsphere/pull/22525?src=pr&el=h1&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation) Report
   > Merging [#22525](https://codecov.io/gh/apache/shardingsphere/pull/22525?src=pr&el=desc&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation) (7368349) into [master](https://codecov.io/gh/apache/shardingsphere/commit/ee7db7d4390824d81a1aac4035d2bddd42954eff?el=desc&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation) (ee7db7d) will **not change** coverage.
   > The diff coverage is `n/a`.
   
   ```diff
   @@            Coverage Diff            @@
   ##             master   #22525   +/-   ##
   =========================================
     Coverage     50.98%   50.98%           
     Complexity     2514     2514           
   =========================================
     Files          4185     4185           
     Lines         58237    58237           
     Branches       9902     9902           
   =========================================
     Hits          29694    29694           
     Misses        26013    26013           
     Partials       2530     2530           
   ```
   
   
   
   :mega: We’re building smart automated test selection to slash your CI/CD build times. [Learn more](https://about.codecov.io/iterative-testing/?utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation)
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: notifications-unsubscribe@shardingsphere.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [shardingsphere] RaigorJiang commented on a diff in pull request #22525: Refactor class-based-sharding-algorithm-example with ShardingSphereDriver

Posted by GitBox <gi...@apache.org>.
RaigorJiang commented on code in PR #22525:
URL: https://github.com/apache/shardingsphere/pull/22525#discussion_r1035640828


##########
examples/shardingsphere-jdbc-example/single-feature-example/extension-example/custom-sharding-algortihm-example/class-based-sharding-algorithm-example/class-based-sharding-spring-namespace-jpa-example/pom.xml:
##########
@@ -36,7 +36,15 @@
         </dependency>
         <dependency>
             <groupId>org.apache.shardingsphere</groupId>
-            <artifactId>shardingsphere-jdbc-core-spring-namespace</artifactId>
+            <artifactId>shardingsphere-jdbc-core</artifactId>
+        </dependency>
+        <dependency>
+            <groupId>org.springframework.boot</groupId>
+            <artifactId>spring-boot-starter-data-jpa</artifactId>
+        </dependency>
+        <dependency>
+            <groupId>org.springframework.boot</groupId>
+            <artifactId>spring-boot-starter-test</artifactId>

Review Comment:
   Why do we need to dependen on `spring-boot-starter-test`?



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: notifications-unsubscribe@shardingsphere.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [shardingsphere] Pace2Car closed pull request #22525: Refactor class-based-sharding-algorithm-example with ShardingSphereDriver

Posted by GitBox <gi...@apache.org>.
Pace2Car closed pull request #22525: Refactor class-based-sharding-algorithm-example with ShardingSphereDriver
URL: https://github.com/apache/shardingsphere/pull/22525


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: notifications-unsubscribe@shardingsphere.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org