Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
apache
Shardingsphere
提交
10f7b6af
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,发现更多精彩内容 >>
提交
10f7b6af
编写于
2月 02, 2019
作者:
T
terrymanu
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
add arg check for KeyGeneratorConfiguration
上级
182d63ff
变更
34
隐藏空白更改
内联
并排
Showing
34 changed file
with
165 addition
and
84 deletion
+165
-84
sharding-core/src/main/java/org/apache/shardingsphere/api/config/sharding/KeyGeneratorConfiguration.java
...sphere/api/config/sharding/KeyGeneratorConfiguration.java
+12
-4
sharding-core/src/main/java/org/apache/shardingsphere/core/rule/MasterSlaveRule.java
.../org/apache/shardingsphere/core/rule/MasterSlaveRule.java
+0
-5
sharding-core/src/main/java/org/apache/shardingsphere/core/yaml/config/sharding/YamlKeyGeneratorConfiguration.java
...e/yaml/config/sharding/YamlKeyGeneratorConfiguration.java
+2
-2
sharding-core/src/main/java/org/apache/shardingsphere/core/yaml/swapper/impl/KeyGeneratorConfigurationYamlSwapper.java
...ml/swapper/impl/KeyGeneratorConfigurationYamlSwapper.java
+2
-2
sharding-core/src/test/java/org/apache/shardingsphere/api/config/AllConfigTests.java
.../org/apache/shardingsphere/api/config/AllConfigTests.java
+3
-1
sharding-core/src/test/java/org/apache/shardingsphere/api/config/encryptor/EncryptorConfigurationTest.java
...here/api/config/encryptor/EncryptorConfigurationTest.java
+12
-1
sharding-core/src/test/java/org/apache/shardingsphere/api/config/masterslave/MasterSlaveRuleConfigurationTest.java
.../config/masterslave/MasterSlaveRuleConfigurationTest.java
+11
-1
sharding-core/src/test/java/org/apache/shardingsphere/api/config/sharding/KeyGeneratorConfigurationTest.java
...re/api/config/sharding/KeyGeneratorConfigurationTest.java
+56
-0
sharding-core/src/test/java/org/apache/shardingsphere/api/config/sharding/strategy/StandardShardingStrategyConfigurationTest.java
...g/strategy/StandardShardingStrategyConfigurationTest.java
+11
-1
sharding-core/src/test/java/org/apache/shardingsphere/core/rule/MasterSlaveRuleTest.java
.../apache/shardingsphere/core/rule/MasterSlaveRuleTest.java
+14
-11
sharding-core/src/test/java/org/apache/shardingsphere/core/rule/ShardingRuleTest.java
...org/apache/shardingsphere/core/rule/ShardingRuleTest.java
+9
-11
sharding-core/src/test/java/org/apache/shardingsphere/core/rule/TableRuleTest.java
...va/org/apache/shardingsphere/core/rule/TableRuleTest.java
+1
-1
sharding-core/src/test/java/org/apache/shardingsphere/core/yaml/swapper/impl/KeyGeneratorConfigurationYamlSwapperTest.java
...wapper/impl/KeyGeneratorConfigurationYamlSwapperTest.java
+4
-4
sharding-core/src/test/resources/yaml/optimize-rule.yaml
sharding-core/src/test/resources/yaml/optimize-rule.yaml
+1
-1
sharding-core/src/test/resources/yaml/parser-rule.yaml
sharding-core/src/test/resources/yaml/parser-rule.yaml
+1
-3
sharding-core/src/test/resources/yaml/rewrite-rule.yaml
sharding-core/src/test/resources/yaml/rewrite-rule.yaml
+1
-1
sharding-core/src/test/resources/yaml/sharding-rule.yaml
sharding-core/src/test/resources/yaml/sharding-rule.yaml
+1
-4
sharding-jdbc/sharding-jdbc-core/src/test/java/org/apache/shardingsphere/shardingjdbc/common/base/AbstractShardingJDBCDatabaseAndTableTest.java
...common/base/AbstractShardingJDBCDatabaseAndTableTest.java
+1
-1
sharding-jdbc/sharding-jdbc-core/src/test/resources/integrate/env/db/sharding-rule.yaml
...re/src/test/resources/integrate/env/db/sharding-rule.yaml
+1
-1
sharding-jdbc/sharding-jdbc-core/src/test/resources/integrate/env/dbtbl_with_masterslave/sharding-rule.yaml
...s/integrate/env/dbtbl_with_masterslave/sharding-rule.yaml
+1
-1
sharding-jdbc/sharding-jdbc-core/src/test/resources/integrate/env/tbl/sharding-rule.yaml
...e/src/test/resources/integrate/env/tbl/sharding-rule.yaml
+1
-1
sharding-jdbc/sharding-jdbc-orchestration/src/test/java/org/apache/shardingsphere/shardingjdbc/orchestration/internal/datasource/OrchestrationShardingDataSourceTest.java
...ernal/datasource/OrchestrationShardingDataSourceTest.java
+4
-3
sharding-jdbc/sharding-jdbc-orchestration/src/test/resources/yaml/integrate/sharding/configWithDataSourceWithProps.yaml
...aml/integrate/sharding/configWithDataSourceWithProps.yaml
+1
-2
sharding-jdbc/sharding-jdbc-orchestration/src/test/resources/yaml/integrate/sharding/configWithDataSourceWithoutProps.yaml
.../integrate/sharding/configWithDataSourceWithoutProps.yaml
+1
-2
sharding-jdbc/sharding-jdbc-orchestration/src/test/resources/yaml/integrate/sharding/configWithoutDataSourceWithProps.yaml
.../integrate/sharding/configWithoutDataSourceWithProps.yaml
+1
-2
sharding-jdbc/sharding-jdbc-orchestration/src/test/resources/yaml/integrate/sharding/configWithoutDataSourceWithoutProps.yaml
...tegrate/sharding/configWithoutDataSourceWithoutProps.yaml
+1
-2
sharding-jdbc/sharding-jdbc-orchestration/src/test/resources/yaml/integrate/sharding_ms/configWithDataSourceWithProps.yaml
.../integrate/sharding_ms/configWithDataSourceWithProps.yaml
+1
-2
sharding-jdbc/sharding-jdbc-orchestration/src/test/resources/yaml/integrate/sharding_ms/configWithDataSourceWithoutProps.yaml
...tegrate/sharding_ms/configWithDataSourceWithoutProps.yaml
+1
-2
sharding-jdbc/sharding-jdbc-orchestration/src/test/resources/yaml/integrate/sharding_ms/configWithoutDataSourceWithProps.yaml
...tegrate/sharding_ms/configWithoutDataSourceWithProps.yaml
+1
-2
sharding-jdbc/sharding-jdbc-orchestration/src/test/resources/yaml/integrate/sharding_ms/configWithoutDataSourceWithoutProps.yaml
...rate/sharding_ms/configWithoutDataSourceWithoutProps.yaml
+1
-2
sharding-jdbc/sharding-jdbc-orchestration/src/test/resources/yaml/unit/sharding.yaml
...-orchestration/src/test/resources/yaml/unit/sharding.yaml
+2
-2
sharding-orchestration/sharding-orchestration-core/src/test/java/org/apache/shardingsphere/orchestration/internal/registry/config/service/ConfigurationServiceTest.java
...nal/registry/config/service/ConfigurationServiceTest.java
+2
-2
sharding-proxy-postgresql/src/main/resources/conf/config-sharding.yaml
...y-postgresql/src/main/resources/conf/config-sharding.yaml
+2
-2
sharding-proxy/src/main/resources/conf/config-sharding.yaml
sharding-proxy/src/main/resources/conf/config-sharding.yaml
+2
-2
未找到文件。
sharding-core/src/main/java/org/apache/shardingsphere/api/config/sharding/KeyGeneratorConfiguration.java
浏览文件 @
10f7b6af
...
...
@@ -17,8 +17,9 @@
package
org.apache.shardingsphere.api.config.sharding
;
import
com.google.common.base.Preconditions
;
import
com.google.common.base.Strings
;
import
lombok.Getter
;
import
lombok.RequiredArgsConstructor
;
import
java.util.Properties
;
...
...
@@ -27,13 +28,20 @@ import java.util.Properties;
*
* @author panjuan
*/
@RequiredArgsConstructor
@Getter
public
final
class
KeyGeneratorConfiguration
{
private
final
String
column
;
private
final
String
type
;
private
final
String
column
;
private
final
Properties
props
;
public
KeyGeneratorConfiguration
(
final
String
type
,
final
String
column
,
final
Properties
props
)
{
Preconditions
.
checkArgument
(!
Strings
.
isNullOrEmpty
(
type
),
"Type is required."
);
Preconditions
.
checkArgument
(!
Strings
.
isNullOrEmpty
(
column
),
"Column is required."
);
this
.
type
=
type
;
this
.
column
=
column
;
this
.
props
=
null
==
props
?
new
Properties
()
:
props
;
}
}
sharding-core/src/main/java/org/apache/shardingsphere/core/rule/MasterSlaveRule.java
浏览文件 @
10f7b6af
...
...
@@ -17,7 +17,6 @@
package
org.apache.shardingsphere.core.rule
;
import
com.google.common.base.Preconditions
;
import
lombok.Getter
;
import
org.apache.shardingsphere.api.algorithm.masterslave.MasterSlaveLoadBalanceAlgorithm
;
import
org.apache.shardingsphere.api.algorithm.masterslave.MasterSlaveLoadBalanceAlgorithmType
;
...
...
@@ -45,10 +44,6 @@ public class MasterSlaveRule {
private
final
MasterSlaveRuleConfiguration
masterSlaveRuleConfiguration
;
public
MasterSlaveRule
(
final
MasterSlaveRuleConfiguration
config
)
{
Preconditions
.
checkNotNull
(
config
.
getName
(),
"Master-slave rule name cannot be null."
);
Preconditions
.
checkNotNull
(
config
.
getMasterDataSourceName
(),
"Master data source name cannot be null."
);
Preconditions
.
checkNotNull
(
config
.
getSlaveDataSourceNames
(),
"Slave data source names cannot be null."
);
Preconditions
.
checkState
(!
config
.
getSlaveDataSourceNames
().
isEmpty
(),
"Slave data source names cannot be empty."
);
name
=
config
.
getName
();
masterDataSourceName
=
config
.
getMasterDataSourceName
();
slaveDataSourceNames
=
config
.
getSlaveDataSourceNames
();
...
...
sharding-core/src/main/java/org/apache/shardingsphere/core/yaml/config/sharding/YamlKeyGeneratorConfiguration.java
浏览文件 @
10f7b6af
...
...
@@ -32,9 +32,9 @@ import java.util.Properties;
@Setter
public
final
class
YamlKeyGeneratorConfiguration
implements
YamlConfiguration
{
private
String
column
;
private
String
type
;
private
String
column
;
private
Properties
props
=
new
Properties
();
}
sharding-core/src/main/java/org/apache/shardingsphere/core/yaml/swapper/impl/KeyGeneratorConfigurationYamlSwapper.java
浏览文件 @
10f7b6af
...
...
@@ -31,14 +31,14 @@ public final class KeyGeneratorConfigurationYamlSwapper implements YamlSwapper<Y
@Override
public
YamlKeyGeneratorConfiguration
swap
(
final
KeyGeneratorConfiguration
data
)
{
YamlKeyGeneratorConfiguration
result
=
new
YamlKeyGeneratorConfiguration
();
result
.
setColumn
(
data
.
getColumn
());
result
.
setType
(
data
.
getType
());
result
.
setColumn
(
data
.
getColumn
());
result
.
setProps
(
data
.
getProps
());
return
result
;
}
@Override
public
KeyGeneratorConfiguration
swap
(
final
YamlKeyGeneratorConfiguration
yamlConfiguration
)
{
return
new
KeyGeneratorConfiguration
(
yamlConfiguration
.
get
Column
(),
yamlConfiguration
.
getType
(),
yamlConfiguration
.
getProps
());
return
new
KeyGeneratorConfiguration
(
yamlConfiguration
.
get
Type
(),
yamlConfiguration
.
getColumn
(),
yamlConfiguration
.
getProps
());
}
}
sharding-core/src/test/java/org/apache/shardingsphere/api/config/AllConfigTests.java
浏览文件 @
10f7b6af
...
...
@@ -19,6 +19,7 @@ package org.apache.shardingsphere.api.config;
import
org.apache.shardingsphere.api.config.encryptor.EncryptorConfigurationTest
;
import
org.apache.shardingsphere.api.config.masterslave.MasterSlaveRuleConfigurationTest
;
import
org.apache.shardingsphere.api.config.sharding.KeyGeneratorConfigurationTest
;
import
org.apache.shardingsphere.api.config.sharding.TableRuleConfigurationTest
;
import
org.apache.shardingsphere.api.config.sharding.strategy.ComplexShardingStrategyConfigurationTest
;
import
org.apache.shardingsphere.api.config.sharding.strategy.HintShardingStrategyConfigurationTest
;
...
...
@@ -35,7 +36,8 @@ import org.junit.runners.Suite.SuiteClasses;
InlineShardingStrategyConfigurationTest
.
class
,
ComplexShardingStrategyConfigurationTest
.
class
,
HintShardingStrategyConfigurationTest
.
class
,
MasterSlaveRuleConfigurationTest
.
class
,
MasterSlaveRuleConfigurationTest
.
class
,
KeyGeneratorConfigurationTest
.
class
,
EncryptorConfigurationTest
.
class
})
public
final
class
AllConfigTests
{
...
...
sharding-core/src/test/java/org/apache/shardingsphere/api/config/encryptor/EncryptorConfigurationTest.java
浏览文件 @
10f7b6af
...
...
@@ -46,7 +46,18 @@ public final class EncryptorConfigurationTest {
}
@Test
public
void
assertConstructorWithFullArguments
()
{
public
void
assertConstructorWithMinArguments
()
{
Properties
props
=
new
Properties
();
props
.
setProperty
(
"key"
,
"value"
);
EncryptorConfiguration
actual
=
new
EncryptorConfiguration
(
"TEST"
,
"pwd"
,
props
);
assertThat
(
actual
.
getType
(),
is
(
"TEST"
));
assertThat
(
actual
.
getColumns
(),
is
(
"pwd"
));
assertThat
(
actual
.
getAssistedQueryColumns
(),
is
(
""
));
assertThat
(
actual
.
getProps
(),
is
(
props
));
}
@Test
public
void
assertConstructorWithMaxArguments
()
{
Properties
props
=
new
Properties
();
props
.
setProperty
(
"key"
,
"value"
);
EncryptorConfiguration
actual
=
new
EncryptorConfiguration
(
"TEST"
,
"pwd"
,
"pwd_query"
,
props
);
...
...
sharding-core/src/test/java/org/apache/shardingsphere/api/config/masterslave/MasterSlaveRuleConfigurationTest.java
浏览文件 @
10f7b6af
...
...
@@ -25,6 +25,7 @@ import java.util.Collection;
import
java.util.Collections
;
import
static
org
.
hamcrest
.
CoreMatchers
.
is
;
import
static
org
.
junit
.
Assert
.
assertNull
;
import
static
org
.
junit
.
Assert
.
assertThat
;
public
final
class
MasterSlaveRuleConfigurationTest
{
...
...
@@ -50,7 +51,16 @@ public final class MasterSlaveRuleConfigurationTest {
}
@Test
public
void
assertConstructorWithFullArguments
()
{
public
void
assertConstructorWithMinArguments
()
{
MasterSlaveRuleConfiguration
actual
=
new
MasterSlaveRuleConfiguration
(
"ds"
,
"master_ds"
,
Collections
.
singletonList
(
"slave_ds"
));
assertThat
(
actual
.
getName
(),
is
(
"ds"
));
assertThat
(
actual
.
getMasterDataSourceName
(),
is
(
"master_ds"
));
assertThat
(
actual
.
getSlaveDataSourceNames
(),
CoreMatchers
.<
Collection
<
String
>>
is
(
Collections
.
singletonList
(
"slave_ds"
)));
assertNull
(
actual
.
getLoadBalanceAlgorithm
());
}
@Test
public
void
assertConstructorWithMaxArguments
()
{
MasterSlaveRuleConfiguration
actual
=
new
MasterSlaveRuleConfiguration
(
"ds"
,
"master_ds"
,
Collections
.
singletonList
(
"slave_ds"
),
MasterSlaveLoadBalanceAlgorithmType
.
getDefaultAlgorithmType
().
getAlgorithm
());
assertThat
(
actual
.
getName
(),
is
(
"ds"
));
...
...
sharding-core/src/test/java/org/apache/shardingsphere/api/config/sharding/KeyGeneratorConfigurationTest.java
0 → 100644
浏览文件 @
10f7b6af
/*
* 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.
*/
package
org.apache.shardingsphere.api.config.sharding
;
import
org.junit.Test
;
import
java.util.Properties
;
import
static
org
.
hamcrest
.
CoreMatchers
.
is
;
import
static
org
.
junit
.
Assert
.
assertThat
;
public
final
class
KeyGeneratorConfigurationTest
{
@Test
(
expected
=
IllegalArgumentException
.
class
)
public
void
assertConstructorWithoutType
()
{
new
KeyGeneratorConfiguration
(
""
,
"id"
,
new
Properties
());
}
@Test
(
expected
=
IllegalArgumentException
.
class
)
public
void
assertConstructorWithoutColumn
()
{
new
KeyGeneratorConfiguration
(
"TEST"
,
""
,
new
Properties
());
}
@Test
public
void
assertConstructorWithoutProperties
()
{
KeyGeneratorConfiguration
actual
=
new
KeyGeneratorConfiguration
(
"TEST"
,
"id"
,
null
);
assertThat
(
actual
.
getType
(),
is
(
"TEST"
));
assertThat
(
actual
.
getColumn
(),
is
(
"id"
));
assertThat
(
actual
.
getProps
(),
is
(
new
Properties
()));
}
@Test
public
void
assertConstructorWithFullArguments
()
{
Properties
props
=
new
Properties
();
props
.
setProperty
(
"key"
,
"value"
);
KeyGeneratorConfiguration
actual
=
new
KeyGeneratorConfiguration
(
"TEST"
,
"id"
,
props
);
assertThat
(
actual
.
getType
(),
is
(
"TEST"
));
assertThat
(
actual
.
getColumn
(),
is
(
"id"
));
assertThat
(
actual
.
getProps
(),
is
(
props
));
}
}
sharding-core/src/test/java/org/apache/shardingsphere/api/config/sharding/strategy/StandardShardingStrategyConfigurationTest.java
浏览文件 @
10f7b6af
...
...
@@ -22,6 +22,7 @@ import org.apache.shardingsphere.api.algorithm.sharding.standard.RangeShardingAl
import
org.junit.Test
;
import
static
org
.
hamcrest
.
CoreMatchers
.
is
;
import
static
org
.
junit
.
Assert
.
assertNull
;
import
static
org
.
junit
.
Assert
.
assertThat
;
import
static
org
.
mockito
.
Mockito
.
mock
;
...
...
@@ -38,7 +39,16 @@ public final class StandardShardingStrategyConfigurationTest {
}
@Test
public
void
assertConstructorWithFullArguments
()
{
public
void
assertConstructorWithMinArguments
()
{
PreciseShardingAlgorithm
preciseShardingAlgorithm
=
mock
(
PreciseShardingAlgorithm
.
class
);
StandardShardingStrategyConfiguration
actual
=
new
StandardShardingStrategyConfiguration
(
"id"
,
preciseShardingAlgorithm
);
assertThat
(
actual
.
getShardingColumn
(),
is
(
"id"
));
assertThat
(
actual
.
getPreciseShardingAlgorithm
(),
is
(
preciseShardingAlgorithm
));
assertNull
(
actual
.
getRangeShardingAlgorithm
());
}
@Test
public
void
assertConstructorWithMaxArguments
()
{
PreciseShardingAlgorithm
preciseShardingAlgorithm
=
mock
(
PreciseShardingAlgorithm
.
class
);
RangeShardingAlgorithm
rangeShardingAlgorithm
=
mock
(
RangeShardingAlgorithm
.
class
);
StandardShardingStrategyConfiguration
actual
=
new
StandardShardingStrategyConfiguration
(
"id"
,
preciseShardingAlgorithm
,
rangeShardingAlgorithm
);
...
...
sharding-core/src/test/java/org/apache/shardingsphere/core/rule/MasterSlaveRuleTest.java
浏览文件 @
10f7b6af
...
...
@@ -22,23 +22,26 @@ import org.junit.Test;
import
java.util.Collections
;
import
static
org
.
junit
.
Assert
.
assertFalse
;
import
static
org
.
junit
.
Assert
.
assertTrue
;
public
final
class
MasterSlaveRuleTest
{
@Test
(
expected
=
NullPointerException
.
class
)
public
void
assert
NewMasterSlaveRuleFailur
e
()
{
MasterSlaveRule
Configuration
masterSlaveRuleConfig
=
new
MasterSlaveRuleConfiguration
(
""
,
""
,
null
);
new
MasterSlaveRule
(
masterSlaveRuleConfig
);
@Test
public
void
assert
ContainDataSourceNameWithMasterDataSourceNam
e
()
{
MasterSlaveRule
actual
=
new
MasterSlaveRule
(
new
MasterSlaveRuleConfiguration
(
"master_slave"
,
"master_ds"
,
Collections
.
singletonList
(
"slave_ds"
))
);
assertTrue
(
actual
.
containDataSourceName
(
"master_ds"
)
);
}
@Test
(
expected
=
IllegalStateException
.
class
)
public
void
assert
NewMasterSlaveRuleWithEmptySlaveDataSourceNames
()
{
MasterSlaveRule
Configuration
masterSlaveRuleConfig
=
new
MasterSlaveRuleConfiguration
(
""
,
""
,
Collections
.<
String
>
emptyList
(
));
new
MasterSlaveRule
(
masterSlaveRuleConfig
);
@Test
public
void
assert
ContainDataSourceNameWithSlaveDataSourceName
()
{
MasterSlaveRule
actual
=
new
MasterSlaveRule
(
new
MasterSlaveRuleConfiguration
(
"master_slave"
,
"master_ds"
,
Collections
.
singletonList
(
"slave_ds"
)
));
assertTrue
(
actual
.
containDataSourceName
(
"slave_ds"
)
);
}
@Test
public
void
assertN
ewMasterSlaveRuleSuccess
()
{
MasterSlaveRule
Configuration
masterSlaveRuleConfig
=
new
MasterSlaveRuleConfiguration
(
"master_slave"
,
"master0"
,
Collections
.
singletonList
(
"slave0"
));
new
MasterSlaveRule
(
masterSlaveRuleConfig
);
public
void
assertN
otContainDataSourceName
()
{
MasterSlaveRule
actual
=
new
MasterSlaveRule
(
new
MasterSlaveRuleConfiguration
(
"master_slave"
,
"master_ds"
,
Collections
.
singletonList
(
"slave_ds"
)
));
assertFalse
(
actual
.
containDataSourceName
(
"master_slave"
)
);
}
}
sharding-core/src/test/java/org/apache/shardingsphere/core/rule/ShardingRuleTest.java
浏览文件 @
10f7b6af
...
...
@@ -277,7 +277,7 @@ public final class ShardingRuleTest {
@Test
public
void
assertNotFindGenerateKeyColumn
()
{
assertFalse
(
createM
ax
imumShardingRule
().
findGenerateKeyColumn
(
"sub_logic_table"
).
isPresent
());
assertFalse
(
createM
in
imumShardingRule
().
findGenerateKeyColumn
(
"sub_logic_table"
).
isPresent
());
}
@Test
(
expected
=
ShardingConfigurationException
.
class
)
...
...
@@ -293,7 +293,6 @@ public final class ShardingRuleTest {
@Test
public
void
assertGenerateKeyWithKeyGenerator
()
{
assertThat
(
createMaximumShardingRule
().
generateKey
(
"logic_table"
),
instanceOf
(
Integer
.
class
));
}
@Test
...
...
@@ -371,29 +370,28 @@ public final class ShardingRuleTest {
private
ShardingRule
createMaximumShardingRule
()
{
ShardingRuleConfiguration
shardingRuleConfiguration
=
new
ShardingRuleConfiguration
();
shardingRuleConfiguration
.
setDefaultDataSourceName
(
"ds_0"
);
TableRuleConfiguration
tableRuleConfiguration
=
createTableRuleConfiguration
(
"LOGIC_TABLE"
,
"ds_${0..1}.table_${0..2}"
,
"id"
);
TableRuleConfiguration
subTableRuleConfiguration
=
createTableRuleConfiguration
(
"SUB_LOGIC_TABLE"
,
"ds_${0..1}.sub_table_${0..2}"
,
null
);
TableRuleConfiguration
tableRuleConfiguration
=
createTableRuleConfiguration
(
"LOGIC_TABLE"
,
"ds_${0..1}.table_${0..2}"
);
tableRuleConfiguration
.
setKeyGeneratorConfig
(
new
KeyGeneratorConfiguration
(
"INCREMENT"
,
"id"
,
new
Properties
()));
TableRuleConfiguration
subTableRuleConfiguration
=
createTableRuleConfiguration
(
"SUB_LOGIC_TABLE"
,
"ds_${0..1}.sub_table_${0..2}"
);
shardingRuleConfiguration
.
getTableRuleConfigs
().
add
(
tableRuleConfiguration
);
shardingRuleConfiguration
.
getTableRuleConfigs
().
add
(
subTableRuleConfiguration
);
shardingRuleConfiguration
.
getBindingTableGroups
().
add
(
tableRuleConfiguration
.
getLogicTable
()
+
","
+
subTableRuleConfiguration
.
getLogicTable
());
shardingRuleConfiguration
.
getBroadcastTables
().
add
(
"BROADCAST_TABLE"
);
shardingRuleConfiguration
.
setDefaultDatabaseShardingStrategyConfig
(
new
InlineShardingStrategyConfiguration
(
"id"
,
"ds_%{id % 2}"
));
shardingRuleConfiguration
.
setDefaultTableShardingStrategyConfig
(
new
InlineShardingStrategyConfiguration
(
"id"
,
"table_%{id % 2}"
));
shardingRuleConfiguration
.
setDefaultKeyGeneratorConfig
(
new
KeyGeneratorConfiguration
(
null
,
"INCREMENT
"
,
new
Properties
()));
shardingRuleConfiguration
.
setDefaultKeyGeneratorConfig
(
new
KeyGeneratorConfiguration
(
"INCREMENT"
,
"id
"
,
new
Properties
()));
return
new
ShardingRule
(
shardingRuleConfiguration
,
createDataSourceNames
());
}
private
ShardingRule
createMinimumShardingRule
()
{
ShardingRuleConfiguration
shardingRuleConfiguration
=
new
ShardingRuleConfiguration
();
TableRuleConfiguration
tableRuleConfiguration
=
createTableRuleConfiguration
(
"LOGIC_TABLE"
,
"ds_${0..1}.table_${0..2}"
,
"id"
);
TableRuleConfiguration
tableRuleConfiguration
=
createTableRuleConfiguration
(
"LOGIC_TABLE"
,
"ds_${0..1}.table_${0..2}"
);
shardingRuleConfiguration
.
getTableRuleConfigs
().
add
(
tableRuleConfiguration
);
return
new
ShardingRule
(
shardingRuleConfiguration
,
createDataSourceNames
());
}
private
TableRuleConfiguration
createTableRuleConfiguration
(
final
String
logicTableName
,
final
String
actualDataNodes
,
final
String
keyGeneratorColumnName
)
{
TableRuleConfiguration
result
=
new
TableRuleConfiguration
(
logicTableName
,
actualDataNodes
);
result
.
setKeyGeneratorConfig
(
new
KeyGeneratorConfiguration
(
keyGeneratorColumnName
,
null
,
new
Properties
()));
return
result
;
private
TableRuleConfiguration
createTableRuleConfiguration
(
final
String
logicTableName
,
final
String
actualDataNodes
)
{
return
new
TableRuleConfiguration
(
logicTableName
,
actualDataNodes
);
}
private
Collection
<
String
>
createDataSourceNames
()
{
...
...
@@ -402,7 +400,7 @@ public final class ShardingRuleTest {
private
ShardingRule
createMasterSlaveShardingRule
()
{
ShardingRuleConfiguration
shardingRuleConfiguration
=
new
ShardingRuleConfiguration
();
TableRuleConfiguration
tableRuleConfiguration
=
createTableRuleConfiguration
(
"LOGIC_TABLE"
,
"ms_ds_${0..1}.table_${0..2}"
,
"id"
);
TableRuleConfiguration
tableRuleConfiguration
=
createTableRuleConfiguration
(
"LOGIC_TABLE"
,
"ms_ds_${0..1}.table_${0..2}"
);
shardingRuleConfiguration
.
getTableRuleConfigs
().
add
(
tableRuleConfiguration
);
shardingRuleConfiguration
.
getMasterSlaveRuleConfigs
().
add
(
createMasterSlaveRuleConfiguration
(
"ms_ds_0"
,
"master_ds_0"
,
"slave_ds_0"
));
shardingRuleConfiguration
.
getMasterSlaveRuleConfigs
().
add
(
createMasterSlaveRuleConfiguration
(
"ms_ds_1"
,
"master_ds_1"
,
"slave_ds_1"
));
...
...
sharding-core/src/test/java/org/apache/shardingsphere/core/rule/TableRuleTest.java
浏览文件 @
10f7b6af
...
...
@@ -58,7 +58,7 @@ public final class TableRuleTest {
TableRuleConfiguration
tableRuleConfig
=
new
TableRuleConfiguration
(
"LOGIC_TABLE"
,
"ds${0..1}.table_${0..2}"
);
tableRuleConfig
.
setDatabaseShardingStrategyConfig
(
new
NoneShardingStrategyConfiguration
());
tableRuleConfig
.
setTableShardingStrategyConfig
(
new
NoneShardingStrategyConfiguration
());
tableRuleConfig
.
setKeyGeneratorConfig
(
new
KeyGeneratorConfiguration
(
"
col_1"
,
"INCREMENT
"
,
new
Properties
()));
tableRuleConfig
.
setKeyGeneratorConfig
(
new
KeyGeneratorConfiguration
(
"
INCREMENT"
,
"col_1
"
,
new
Properties
()));
tableRuleConfig
.
setLogicIndex
(
"LOGIC_INDEX"
);
TableRule
actual
=
new
TableRule
(
tableRuleConfig
,
createShardingDataSourceNames
(),
null
);
assertThat
(
actual
.
getLogicTable
(),
is
(
"logic_table"
));
...
...
sharding-core/src/test/java/org/apache/shardingsphere/core/yaml/swapper/impl/KeyGeneratorConfigurationYamlSwapperTest.java
浏览文件 @
10f7b6af
...
...
@@ -30,20 +30,20 @@ public final class KeyGeneratorConfigurationYamlSwapperTest {
@Test
public
void
assertSwapToYaml
()
{
YamlKeyGeneratorConfiguration
actual
=
new
KeyGeneratorConfigurationYamlSwapper
().
swap
(
new
KeyGeneratorConfiguration
(
"id"
,
"UUID"
,
new
Properties
()));
assertThat
(
actual
.
getColumn
(),
is
(
"id"
));
YamlKeyGeneratorConfiguration
actual
=
new
KeyGeneratorConfigurationYamlSwapper
().
swap
(
new
KeyGeneratorConfiguration
(
"UUID"
,
"id"
,
new
Properties
()));
assertThat
(
actual
.
getType
(),
is
(
"UUID"
));
assertThat
(
actual
.
getColumn
(),
is
(
"id"
));
assertThat
(
actual
.
getProps
(),
is
(
new
Properties
()));
}
@Test
public
void
assertSwapToObject
()
{
YamlKeyGeneratorConfiguration
yamlConfiguration
=
new
YamlKeyGeneratorConfiguration
();
yamlConfiguration
.
setColumn
(
"id"
);
yamlConfiguration
.
setType
(
"UUID"
);
yamlConfiguration
.
setColumn
(
"id"
);
KeyGeneratorConfiguration
actual
=
new
KeyGeneratorConfigurationYamlSwapper
().
swap
(
yamlConfiguration
);
assertThat
(
actual
.
getColumn
(),
is
(
"id"
));
assertThat
(
actual
.
getType
(),
is
(
"UUID"
));
assertThat
(
actual
.
getColumn
(),
is
(
"id"
));
assertThat
(
actual
.
getProps
(),
is
(
new
Properties
()));
}
}
sharding-core/src/test/resources/yaml/optimize-rule.yaml
浏览文件 @
10f7b6af
...
...
@@ -23,6 +23,6 @@ shardingRule:
shardingColumn
:
order_id
algorithmExpression
:
t_order_${order_id % 2}
keyGenerator
:
column
:
order_id
type
:
SNOWFLAKE
column
:
order_id
logicIndex
:
order_index
sharding-core/src/test/resources/yaml/parser-rule.yaml
浏览文件 @
10f7b6af
...
...
@@ -26,8 +26,8 @@ shardingRule:
shardingColumns
:
user_id, order_id, item_id
algorithmClassName
:
org.apache.shardingsphere.api.algorithm.fixture.TestComplexKeysShardingAlgorithm
keyGenerator
:
column
:
item_id
type
:
SNOWFLAKE
column
:
item_id
t_place
:
actualDataNodes
:
db${0..1}.t_place
tableStrategy
:
...
...
@@ -36,5 +36,3 @@ shardingRule:
algorithmClassName
:
org.apache.shardingsphere.api.algorithm.fixture.TestComplexKeysShardingAlgorithm
bindingTables
:
-
t_order, t_order_item
defaultKeyGenerator
:
type
:
SNOWFLAKE
sharding-core/src/test/resources/yaml/rewrite-rule.yaml
浏览文件 @
10f7b6af
...
...
@@ -15,8 +15,8 @@ shardingRule:
table_x
:
actualDataNodes
:
db${0..1}.table_x
keyGenerator
:
column
:
id
type
:
SNOWFLAKE
column
:
id
logicIndex
:
logic_index
table_y
:
actualDataNodes
:
db${0..1}.table_y
...
...
sharding-core/src/test/resources/yaml/sharding-rule.yaml
浏览文件 @
10f7b6af
...
...
@@ -62,8 +62,8 @@ shardingRule:
shardingColumn
:
order_id
algorithmExpression
:
t_order_${order_id % 2}
keyGenerator
:
column
:
order_id
type
:
SNOWFLAKE
column
:
order_id
logicIndex
:
order_index
t_order_item
:
actualDataNodes
:
ds_${0..1}.t_order_item_${0..1}
...
...
@@ -83,9 +83,6 @@ shardingRule:
algorithmExpression
:
ds_${order_id % 2}
defaultTableStrategy
:
none
:
defaultKeyGenerator
:
type
:
SNOWFLAKE
masterSlaveRules
:
ds_0
:
masterDataSourceName
:
master_ds_0
...
...
sharding-jdbc/sharding-jdbc-core/src/test/java/org/apache/shardingsphere/shardingjdbc/common/base/AbstractShardingJDBCDatabaseAndTableTest.java
浏览文件 @
10f7b6af
...
...
@@ -65,7 +65,7 @@ public abstract class AbstractShardingJDBCDatabaseAndTableTest extends AbstractS
orderItemActualDataNodes
.
add
(
dataSourceName
+
".t_order_item_${0..1}"
);
}
TableRuleConfiguration
orderItemTableRuleConfig
=
new
TableRuleConfiguration
(
"t_order_item"
,
Joiner
.
on
(
","
).
join
(
orderItemActualDataNodes
));
orderItemTableRuleConfig
.
setKeyGeneratorConfig
(
new
KeyGeneratorConfiguration
(
"
item_id"
,
"INCREMENT
"
,
new
Properties
()));
orderItemTableRuleConfig
.
setKeyGeneratorConfig
(
new
KeyGeneratorConfiguration
(
"
INCREMENT"
,
"item_id
"
,
new
Properties
()));
shardingRuleConfig
.
getTableRuleConfigs
().
add
(
orderItemTableRuleConfig
);
TableRuleConfiguration
configTableRuleConfig
=
new
TableRuleConfiguration
(
"t_config"
);
shardingRuleConfig
.
getTableRuleConfigs
().
add
(
configTableRuleConfig
);
...
...
sharding-jdbc/sharding-jdbc-core/src/test/resources/integrate/env/db/sharding-rule.yaml
浏览文件 @
10f7b6af
...
...
@@ -16,8 +16,8 @@ shardingRule:
preciseAlgorithmClassName
:
org.apache.shardingsphere.dbtest.fixture.PreciseModuloAlgorithm
rangeAlgorithmClassName
:
org.apache.shardingsphere.dbtest.fixture.RangeModuloAlgorithm
keyGenerator
:
column
:
item_id
type
:
CONSTANT
column
:
item_id
bindingTables
:
-
t_order,t_order_item
defaultDataSourceName
:
db_0
sharding-jdbc/sharding-jdbc-core/src/test/resources/integrate/env/dbtbl_with_masterslave/sharding-rule.yaml
浏览文件 @
10f7b6af
...
...
@@ -28,8 +28,8 @@ shardingRule:
preciseAlgorithmClassName
:
org.apache.shardingsphere.dbtest.fixture.PreciseModuloAlgorithm
rangeAlgorithmClassName
:
org.apache.shardingsphere.dbtest.fixture.RangeModuloAlgorithm
keyGenerator
:
column
:
item_id
type
:
Constant
column
:
item_id
bindingTables
:
-
t_order,t_order_item
defaultDataSourceName
:
db_ms_0
...
...
sharding-jdbc/sharding-jdbc-core/src/test/resources/integrate/env/tbl/sharding-rule.yaml
浏览文件 @
10f7b6af
...
...
@@ -16,8 +16,8 @@ shardingRule:
preciseAlgorithmClassName
:
org.apache.shardingsphere.dbtest.fixture.PreciseModuloAlgorithm
rangeAlgorithmClassName
:
org.apache.shardingsphere.dbtest.fixture.RangeModuloAlgorithm
keyGenerator
:
column
:
item_id
type
:
Constant
column
:
item_id
bindingTables
:
-
t_order,t_order_item
defaultDataSourceName
:
tbl
sharding-jdbc/sharding-jdbc-orchestration/src/test/java/org/apache/shardingsphere/shardingjdbc/orchestration/internal/datasource/OrchestrationShardingDataSourceTest.java
浏览文件 @
10f7b6af
...
...
@@ -40,6 +40,8 @@ import org.junit.BeforeClass;
import
org.junit.Test
;
import
java.io.File
;
import
java.io.IOException
;
import
java.net.URISyntaxException
;
import
java.sql.Connection
;
import
java.sql.SQLException
;
import
java.util.Collections
;
...
...
@@ -56,12 +58,11 @@ public final class OrchestrationShardingDataSourceTest {
private
static
OrchestrationShardingDataSource
shardingDataSource
;
@BeforeClass
public
static
void
setUp
()
throws
SQLException
{
public
static
void
setUp
()
throws
SQLException
,
IOException
,
URISyntaxException
{
shardingDataSource
=
new
OrchestrationShardingDataSource
(
getShardingDataSource
(),
getOrchestrationConfiguration
());
}
@SneakyThrows
private
static
ShardingDataSource
getShardingDataSource
()
{
private
static
ShardingDataSource
getShardingDataSource
()
throws
IOException
,
SQLException
,
URISyntaxException
{
File
yamlFile
=
new
File
(
OrchestrationShardingDataSourceTest
.
class
.
getResource
(
"/yaml/unit/sharding.yaml"
).
toURI
());
return
(
ShardingDataSource
)
YamlShardingDataSourceFactory
.
createDataSource
(
yamlFile
);
}
...
...
sharding-jdbc/sharding-jdbc-orchestration/src/test/resources/yaml/integrate/sharding/configWithDataSourceWithProps.yaml
浏览文件 @
10f7b6af
...
...
@@ -28,9 +28,8 @@ shardingRule:
shardingColumn
:
order_id
algorithmExpression
:
t_order_${order_id % 2}
keyGenerator
:
column
:
order_id
type
:
INCREMENT
column
:
order_id
t_order_item
:
actualDataNodes
:
db${0..1}.t_order_item_${0..1}
databaseStrategy
:
...
...
sharding-jdbc/sharding-jdbc-orchestration/src/test/resources/yaml/integrate/sharding/configWithDataSourceWithoutProps.yaml
浏览文件 @
10f7b6af
...
...
@@ -28,9 +28,8 @@ shardingRule:
shardingColumn
:
order_id
algorithmExpression
:
t_order_${order_id % 2}
keyGenerator
:
column
:
order_id
type
:
INCREMENT
column
:
order_id
t_order_item
:
actualDataNodes
:
db${0..1}.t_order_item_${0..1}
databaseStrategy
:
...
...
sharding-jdbc/sharding-jdbc-orchestration/src/test/resources/yaml/integrate/sharding/configWithoutDataSourceWithProps.yaml
浏览文件 @
10f7b6af
...
...
@@ -14,9 +14,8 @@ shardingRule:
shardingColumn
:
order_id
algorithmExpression
:
t_order_${order_id % 2}
keyGenerator
:
column
:
order_id
type
:
INCREMENT
column
:
order_id
t_order_item
:
actualDataNodes
:
db${0..1}.t_order_item_${0..1}
databaseStrategy
:
...
...
sharding-jdbc/sharding-jdbc-orchestration/src/test/resources/yaml/integrate/sharding/configWithoutDataSourceWithoutProps.yaml
浏览文件 @
10f7b6af
...
...
@@ -13,9 +13,8 @@ shardingRule:
shardingColumn
:
order_id
algorithmExpression
:
t_order_${order_id % 2}
keyGenerator
:
column
:
order_id
type
:
INCREMENT
column
:
order_id
t_order_item
:
actualDataNodes
:
db${0..1}.t_order_item_${0..1}
databaseStrategy
:
...
...
sharding-jdbc/sharding-jdbc-orchestration/src/test/resources/yaml/integrate/sharding_ms/configWithDataSourceWithProps.yaml
浏览文件 @
10f7b6af
...
...
@@ -40,9 +40,8 @@ shardingRule:
shardingColumn
:
order_id
algorithmExpression
:
t_order_${order_id % 2}
keyGenerator
:
column
:
order_id
type
:
INCREMENT
column
:
order_id
t_order_item
:
actualDataNodes
:
db_ms_${0..1}.t_order_item_${0..1}
databaseStrategy
:
...
...
sharding-jdbc/sharding-jdbc-orchestration/src/test/resources/yaml/integrate/sharding_ms/configWithDataSourceWithoutProps.yaml
浏览文件 @
10f7b6af
...
...
@@ -40,9 +40,8 @@ shardingRule:
shardingColumn
:
order_id
algorithmExpression
:
t_order_${order_id % 2}
keyGenerator
:
column
:
order_id
type
:
INCREMENT
column
:
order_id
t_order_item
:
actualDataNodes
:
db_ms_${0..1}.t_order_item_${0..1}
databaseStrategy
:
...
...
sharding-jdbc/sharding-jdbc-orchestration/src/test/resources/yaml/integrate/sharding_ms/configWithoutDataSourceWithProps.yaml
浏览文件 @
10f7b6af
...
...
@@ -14,9 +14,8 @@ shardingRule:
shardingColumn
:
order_id
algorithmExpression
:
t_order_${order_id % 2}
keyGenerator
:
column
:
order_id
type
:
INCREMENT
column
:
order_id
t_order_item
:
actualDataNodes
:
db_ms_${0..1}.t_order_item_${0..1}
databaseStrategy
:
...
...
sharding-jdbc/sharding-jdbc-orchestration/src/test/resources/yaml/integrate/sharding_ms/configWithoutDataSourceWithoutProps.yaml
浏览文件 @
10f7b6af
...
...
@@ -14,9 +14,8 @@ shardingRule:
shardingColumn
:
order_id
algorithmExpression
:
t_order_${order_id % 2}
keyGenerator
:
column
:
order_id
type
:
INCREMENT
column
:
order_id
t_order_item
:
actualDataNodes
:
db_ms_${0..1}.t_order_item_${0..1}
databaseStrategy
:
...
...
sharding-jdbc/sharding-jdbc-orchestration/src/test/resources/yaml/unit/sharding.yaml
浏览文件 @
10f7b6af
...
...
@@ -23,6 +23,7 @@ shardingRule:
shardingColumn
:
order_id
algorithmExpression
:
t_order_${order_id % 2}
keyGenerator
:
type
:
SNOWFLAKE
column
:
order_id
t_order_item
:
actualDataNodes
:
ds_ms.t_order_item_${0..1}
...
...
@@ -31,6 +32,7 @@ shardingRule:
shardingColumn
:
order_id
algorithmExpression
:
t_order_item_${order_id % 2}
keyGenerator
:
type
:
SNOWFLAKE
column
:
order_item_id
bindingTables
:
-
t_order,t_order_item
...
...
@@ -45,7 +47,5 @@ shardingRule:
algorithmExpression
:
ds_ms_${user_id % 2}
defaultTableStrategy
:
none
:
defaultKeyGenerator
:
type
:
SNOWFLAKE
props
:
sql.show
:
false
\ No newline at end of file
sharding-orchestration/sharding-orchestration-core/src/test/java/org/apache/shardingsphere/orchestration/internal/registry/config/service/ConfigurationServiceTest.java
浏览文件 @
10f7b6af
...
...
@@ -72,8 +72,8 @@ public final class ConfigurationServiceTest {
+
"ds_1: !!org.apache.shardingsphere.core.rule.DataSourceParameter\n"
+
" url: jdbc:mysql://localhost:3306/ds_1\n"
+
" username: root\n"
+
" password: root\n"
;
private
static
final
String
SHARDING_RULE_YAML
=
"tables:\n"
+
" t_order:\n"
+
" actualDataNodes: ds_${0..1}.t_order_${0..1}\n"
+
" keyGenerator:\n"
+
"
type: SNOWFLAKE\n"
+
"
logicTable: t_order\n"
+
" tableStrategy:\n"
+
" inline:\n"
+
" algorithmExpression: t_order_${order_id % 2}\n"
private
static
final
String
SHARDING_RULE_YAML
=
"tables:\n"
+
" t_order:\n"
+
" actualDataNodes: ds_${0..1}.t_order_${0..1}\n"
+
" logicTable: t_order\n"
+
" tableStrategy:\n"
+
" inline:\n"
+
" algorithmExpression: t_order_${order_id % 2}\n"
+
" shardingColumn: order_id\n"
;
private
static
final
String
MASTER_SLAVE_RULE_YAML
=
"masterDataSourceName: master_ds\n"
+
"name: ms_ds\n"
+
"slaveDataSourceNames:\n"
+
"- slave_ds_0\n"
+
"- slave_ds_1\n"
;
...
...
sharding-proxy-postgresql/src/main/resources/conf/config-sharding.yaml
浏览文件 @
10f7b6af
...
...
@@ -37,6 +37,7 @@ shardingRule:
shardingColumn
:
order_id
algorithmExpression
:
t_order_${order_id % 2}
keyGenerator
:
type
:
SNOWFLAKE
column
:
order_id
t_order_item
:
actualDataNodes
:
ds_${0..1}.t_order_item_${0..1}
...
...
@@ -45,6 +46,7 @@ shardingRule:
shardingColumn
:
order_id
algorithmExpression
:
t_order_item_${order_id % 2}
keyGenerator
:
type
:
SNOWFLAKE
column
:
order_item_id
bindingTables
:
-
t_order,t_order_item
...
...
@@ -54,5 +56,3 @@ shardingRule:
algorithmExpression
:
ds_${user_id % 2}
defaultTableStrategy
:
none
:
defaultKeyGenerator
:
type
:
SNOWFLAKE
sharding-proxy/src/main/resources/conf/config-sharding.yaml
浏览文件 @
10f7b6af
...
...
@@ -37,6 +37,7 @@
# shardingColumn: order_id
# algorithmExpression: t_order_${order_id % 2}
# keyGenerator:
# type: SNOWFLAKE
# column: order_id
# t_order_item:
# actualDataNodes: ds_${0..1}.t_order_item_${0..1}
...
...
@@ -45,6 +46,7 @@
# shardingColumn: order_id
# algorithmExpression: t_order_item_${order_id % 2}
# keyGenerator:
# type: SNOWFLAKE
# column: order_item_id
# bindingTables:
# - t_order,t_order_item
...
...
@@ -54,5 +56,3 @@
# algorithmExpression: ds_${user_id % 2}
# defaultTableStrategy:
# none:
# defaultKeyGenerator:
# type: SNOWFLAKE
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录