Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
apache
Shardingsphere
提交
b1261d65
Shardingsphere
项目概览
apache
/
Shardingsphere
通知
56
Star
3
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
DevOps
流水线
流水线任务
计划
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
Shardingsphere
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
DevOps
DevOps
流水线
流水线任务
计划
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
流水线任务
提交
Issue看板
体验新版 GitCode,发现更多精彩内容 >>
提交
b1261d65
编写于
9月 22, 2017
作者:
H
haocao
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Refactor sharding-jdbc-spring examples 6th.
上级
2dfa55fc
变更
11
显示空白变更内容
内联
并排
Showing
11 changed file
with
8 addition
and
22 deletion
+8
-22
pom.xml
pom.xml
+2
-2
sharding-jdbc-orchestration-example/pom.xml
sharding-jdbc-orchestration-example/pom.xml
+1
-1
sharding-jdbc-orchestration-example/src/main/java/io/shardingjdbc/example/orchestration/Main.java
...main/java/io/shardingjdbc/example/orchestration/Main.java
+2
-8
sharding-jdbc-orchestration-example/src/main/java/io/shardingjdbc/example/orchestration/algorithm/ModuloTableShardingAlgorithm.java
...orchestration/algorithm/ModuloTableShardingAlgorithm.java
+0
-0
sharding-jdbc-orchestration-example/src/main/resources/all_schema.sql
...c-orchestration-example/src/main/resources/all_schema.sql
+0
-0
sharding-jdbc-orchestration-example/src/main/resources/logback.xml
...jdbc-orchestration-example/src/main/resources/logback.xml
+0
-0
sharding-jdbc-transaction-example/pom.xml
sharding-jdbc-transaction-example/pom.xml
+1
-1
sharding-jdbc-transaction-example/src/main/java/io/shardingjdbc/example/transaction/Main.java
...c/main/java/io/shardingjdbc/example/transaction/Main.java
+2
-10
sharding-jdbc-transaction-example/src/main/java/io/shardingjdbc/example/transaction/algorithm/ModuloShardingAlgorithm.java
...xample/transaction/algorithm/ModuloShardingAlgorithm.java
+0
-0
sharding-jdbc-transaction-example/src/main/resources/all_schema.sql
...dbc-transaction-example/src/main/resources/all_schema.sql
+0
-0
sharding-jdbc-transaction-example/src/main/resources/logback.xml
...g-jdbc-transaction-example/src/main/resources/logback.xml
+0
-0
未找到文件。
pom.xml
浏览文件 @
b1261d65
...
...
@@ -6,10 +6,10 @@
<packaging>
pom
</packaging>
<modules>
<module>
sharding-jdbc-example-jdbc-transaction
</module>
<module>
sharding-jdbc-raw-jdbc-example
</module>
<module>
sharding-jdbc-spring-namespace-example
</module>
<module>
sharding-jdbc-example-orchestration
</module>
<module>
sharding-jdbc-orchestration-example
</module>
<module>
sharding-jdbc-transaction-example
</module>
</modules>
<properties>
...
...
sharding-jdbc-
example-orchestration
/pom.xml
→
sharding-jdbc-
orchestration-example
/pom.xml
浏览文件 @
b1261d65
...
...
@@ -6,5 +6,5 @@
<version>
2.0.0.M1-SNAPSHOT
</version>
</parent>
<modelVersion>
4.0.0
</modelVersion>
<artifactId>
sharding-jdbc-
example-orchestration
</artifactId>
<artifactId>
sharding-jdbc-
orchestration-example
</artifactId>
</project>
sharding-jdbc-
example-orchestration
/src/main/java/io/shardingjdbc/example/orchestration/Main.java
→
sharding-jdbc-
orchestration-example
/src/main/java/io/shardingjdbc/example/orchestration/Main.java
浏览文件 @
b1261d65
...
...
@@ -93,14 +93,8 @@ public final class Main {
orderItemTableRuleConfig
.
setActualTables
(
"t_order_item_${[0, 1]}"
);
result
.
getTableRuleConfigs
().
add
(
orderItemTableRuleConfig
);
result
.
getBindingTableGroups
().
add
(
"t_order, t_order_item"
);
InlineShardingStrategyConfiguration
databaseShardingStrategyConfig
=
new
InlineShardingStrategyConfiguration
();
databaseShardingStrategyConfig
.
setShardingColumn
(
"user_id"
);
databaseShardingStrategyConfig
.
setAlgorithmInlineExpression
(
"ds_jdbc_${user_id % 2}"
);
result
.
setDefaultDatabaseShardingStrategyConfig
(
databaseShardingStrategyConfig
);
StandardShardingStrategyConfiguration
tableShardingStrategyConfig
=
new
StandardShardingStrategyConfiguration
();
tableShardingStrategyConfig
.
setShardingColumn
(
"order_id"
);
tableShardingStrategyConfig
.
setPreciseAlgorithmClassName
(
ModuloTableShardingAlgorithm
.
class
.
getName
());
result
.
setDefaultTableShardingStrategyConfig
(
tableShardingStrategyConfig
);
result
.
setDefaultDatabaseShardingStrategyConfig
(
new
InlineShardingStrategyConfiguration
(
"user_id"
,
"ds_jdbc_${user_id % 2}"
));
result
.
setDefaultTableShardingStrategyConfig
(
new
StandardShardingStrategyConfiguration
(
"order_id"
,
ModuloTableShardingAlgorithm
.
class
.
getName
()));
return
result
;
}
...
...
sharding-jdbc-
example-orchestration
/src/main/java/io/shardingjdbc/example/orchestration/algorithm/ModuloTableShardingAlgorithm.java
→
sharding-jdbc-
orchestration-example
/src/main/java/io/shardingjdbc/example/orchestration/algorithm/ModuloTableShardingAlgorithm.java
浏览文件 @
b1261d65
文件已移动
sharding-jdbc-
example-orchestration
/src/main/resources/all_schema.sql
→
sharding-jdbc-
orchestration-example
/src/main/resources/all_schema.sql
浏览文件 @
b1261d65
文件已移动
sharding-jdbc-
example-orchestration
/src/main/resources/logback.xml
→
sharding-jdbc-
orchestration-example
/src/main/resources/logback.xml
浏览文件 @
b1261d65
文件已移动
sharding-jdbc-
example-jdbc-transaction
/pom.xml
→
sharding-jdbc-
transaction-example
/pom.xml
浏览文件 @
b1261d65
...
...
@@ -5,5 +5,5 @@
<artifactId>
sharding-jdbc-example
</artifactId>
<version>
2.0.0.M1-SNAPSHOT
</version>
</parent>
<artifactId>
sharding-jdbc-
example-jdbc-transaction
</artifactId>
<artifactId>
sharding-jdbc-
transaction-example
</artifactId>
</project>
sharding-jdbc-
example-jdbc-transaction
/src/main/java/io/shardingjdbc/example/transaction/Main.java
→
sharding-jdbc-
transaction-example
/src/main/java/io/shardingjdbc/example/transaction/Main.java
浏览文件 @
b1261d65
...
...
@@ -88,16 +88,8 @@ public final class Main {
shardingRuleConfig
.
getBindingTableGroups
().
add
(
"t_order, t_order_item"
);
StandardShardingStrategyConfiguration
databaseShardingStrategyConfig
=
new
StandardShardingStrategyConfiguration
();
databaseShardingStrategyConfig
.
setShardingColumn
(
"user_id"
);
databaseShardingStrategyConfig
.
setPreciseAlgorithmClassName
(
ModuloShardingAlgorithm
.
class
.
getName
());
shardingRuleConfig
.
setDefaultDatabaseShardingStrategyConfig
(
databaseShardingStrategyConfig
);
StandardShardingStrategyConfiguration
tableShardingStrategyConfig
=
new
StandardShardingStrategyConfiguration
();
tableShardingStrategyConfig
.
setShardingColumn
(
"order_id"
);
tableShardingStrategyConfig
.
setPreciseAlgorithmClassName
(
ModuloShardingAlgorithm
.
class
.
getName
());
shardingRuleConfig
.
setDefaultTableShardingStrategyConfig
(
tableShardingStrategyConfig
);
shardingRuleConfig
.
setDefaultDatabaseShardingStrategyConfig
(
new
StandardShardingStrategyConfiguration
(
"user_id"
,
ModuloShardingAlgorithm
.
class
.
getName
()));
shardingRuleConfig
.
setDefaultTableShardingStrategyConfig
(
new
StandardShardingStrategyConfiguration
(
"order_id"
,
ModuloShardingAlgorithm
.
class
.
getName
()));
return
new
ShardingDataSource
(
shardingRuleConfig
.
build
(
createDataSourceMap
()));
}
...
...
sharding-jdbc-
example-jdbc-transaction
/src/main/java/io/shardingjdbc/example/transaction/algorithm/ModuloShardingAlgorithm.java
→
sharding-jdbc-
transaction-example
/src/main/java/io/shardingjdbc/example/transaction/algorithm/ModuloShardingAlgorithm.java
浏览文件 @
b1261d65
文件已移动
sharding-jdbc-
example-jdbc-transaction
/src/main/resources/all_schema.sql
→
sharding-jdbc-
transaction-example
/src/main/resources/all_schema.sql
浏览文件 @
b1261d65
文件已移动
sharding-jdbc-
example-jdbc-transaction
/src/main/resources/logback.xml
→
sharding-jdbc-
transaction-example
/src/main/resources/logback.xml
浏览文件 @
b1261d65
文件已移动
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录