public final class ShardingRule extends Object
| 限定符和类型 | 类和说明 |
|---|---|
static class |
ShardingRule.ShardingRuleBuilder
Sharding rule builder.
|
| 构造器和说明 |
|---|
ShardingRule(DataSourceRule dataSourceRule,
Collection<TableRule> tableRules,
Collection<BindingTableRule> bindingTableRules,
DatabaseShardingStrategy databaseShardingStrategy,
TableShardingStrategy tableShardingStrategy,
KeyGenerator keyGenerator)
已过时。
should be private
|
| 限定符和类型 | 方法和说明 |
|---|---|
static ShardingRule.ShardingRuleBuilder |
builder()
Get sharding rule builder.
|
Collection<String> |
filterAllBindingTables(Collection<String> logicTables)
Filter all binding tables.
|
com.google.common.base.Optional<BindingTableRule> |
findBindingTableRule(String logicTable)
Get binding table rule via logic table name.
|
Number |
generateKey(String logicTableName)
Generate key.
|
DatabaseShardingStrategy |
getDatabaseShardingStrategy(TableRule tableRule)
Get database sharding strategy.
|
com.google.common.base.Optional<String> |
getGenerateKeyColumn(String logicTableName)
get generated key's column name.
|
TableRule |
getTableRule(String logicTableName)
Find table rule though logic table name.
|
TableShardingStrategy |
getTableShardingStrategy(TableRule tableRule)
Get table sharding strategy.
|
boolean |
isAllBindingTables(Collection<String> logicTables)
Adjust logic tables is all belong to binding tables.
|
boolean |
isShardingColumn(Column column)
Adjust is sharding column or not.
|
com.google.common.base.Optional<TableRule> |
tryFindTableRule(String logicTableName)
Try to find table rule though logic table name.
|
@Deprecated public ShardingRule(DataSourceRule dataSourceRule, Collection<TableRule> tableRules, Collection<BindingTableRule> bindingTableRules, DatabaseShardingStrategy databaseShardingStrategy, TableShardingStrategy tableShardingStrategy, KeyGenerator keyGenerator)
Should not use for spring namespace.
dataSourceRule - data source ruletableRules - table rulesbindingTableRules - binding table rulesdatabaseShardingStrategy - default database sharding strategytableShardingStrategy - default table sharding strategykeyGenerator - default primary key generatorpublic static ShardingRule.ShardingRuleBuilder builder()
public com.google.common.base.Optional<TableRule> tryFindTableRule(String logicTableName)
logicTableName - logic table namepublic TableRule getTableRule(String logicTableName)
logicTableName - logic table namepublic DatabaseShardingStrategy getDatabaseShardingStrategy(TableRule tableRule)
Use default database sharding strategy if not found.
tableRule - table rulepublic TableShardingStrategy getTableShardingStrategy(TableRule tableRule)
Use default table sharding strategy if not found.
tableRule - table rulepublic boolean isAllBindingTables(Collection<String> logicTables)
logicTables - names of logic tablespublic Collection<String> filterAllBindingTables(Collection<String> logicTables)
logicTables - names of logic tablespublic com.google.common.base.Optional<BindingTableRule> findBindingTableRule(String logicTable)
logicTable - logic table namepublic boolean isShardingColumn(Column column)
column - column objectpublic com.google.common.base.Optional<String> getGenerateKeyColumn(String logicTableName)
logicTableName - logic table nameCopyright © 2017. All rights reserved.