Skip to content

Commit

Permalink
fix doc error
Browse files Browse the repository at this point in the history
  • Loading branch information
hanahmily committed Feb 22, 2016
1 parent 15a37c1 commit c7860b9
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions sharding-jdbc-doc/content/post/user_guide.md
Original file line number Diff line number Diff line change
Expand Up @@ -225,7 +225,7 @@ public Collection<String> doBetweenSharding(final Collection<String> availableTa

下面是一个余2的算法的例子,当分片键的值除以2余数就是实际表的结尾。注意注释中提供了一些算法生成SQL的结果,参数`tableNames`集合中有两个参数`t_order_0``t_order_1`
```java
public final class ModuloDatabaseShardingAlgorithm implements SingleKeyDatabaseShardingAlgorithm<Integer> {
public final class ModuloDatabaseShardingAlgorithm implements SingleKeyTableShardingAlgorithm<Integer> {

/**
* select * from t_order from t_order where order_id = 11
Expand Down Expand Up @@ -254,9 +254,9 @@ public Collection<String> doBetweenSharding(final Collection<String> availableTa
public Collection<String> doInSharding(final Collection<String> tableNames, final ShardingValue<Integer> shardingValue) {
Collection<String> result = new LinkedHashSet<>(tableNames.size());
for (Integer value : shardingValue.getValues()) {
for (String dataSourceName : tableNames) {
if (dataSourceName.endsWith(value % 2 + "")) {
result.add(dataSourceName);
for (String tableName : tableNames) {
if (tableName.endsWith(value % 2 + "")) {
result.add(tableName);
}
}
}
Expand Down

0 comments on commit c7860b9

Please sign in to comment.