public final class ShardingRule extends Object
| 构造器和说明 |
|---|
ShardingRule(Map<String,DataSource> dataSourceMap,
String defaultDataSourceName,
Collection<TableRule> tableRules,
Collection<String> bindingTableGroups,
ShardingStrategy defaultDatabaseShardingStrategy,
ShardingStrategy defaultTableShardingStrategy,
KeyGenerator defaultKeyGenerator) |
| 限定符和类型 | 方法和说明 |
|---|---|
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.
|
ShardingStrategy |
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.
|
ShardingStrategy |
getTableShardingStrategy(TableRule tableRule)
Get table sharding strategy.
|
boolean |
isAllBindingTables(Collection<String> logicTables)
Adjust logic tables is all belong to binding tables.
|
boolean |
isAllInDefaultDataSource(Collection<String> logicTables)
Adjust logic tables is all belong to default data source.
|
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.
|
public ShardingRule(Map<String,DataSource> dataSourceMap, String defaultDataSourceName, Collection<TableRule> tableRules, Collection<String> bindingTableGroups, ShardingStrategy defaultDatabaseShardingStrategy, ShardingStrategy defaultTableShardingStrategy, KeyGenerator defaultKeyGenerator)
public com.google.common.base.Optional<TableRule> tryFindTableRule(String logicTableName)
logicTableName - logic table namepublic TableRule getTableRule(String logicTableName)
logicTableName - logic table namepublic ShardingStrategy getDatabaseShardingStrategy(TableRule tableRule)
Use default database sharding strategy if not found.
tableRule - table rulepublic ShardingStrategy getTableShardingStrategy(TableRule tableRule)
Use default table sharding strategy if not found.
tableRule - table rulepublic boolean isAllBindingTables(Collection<String> logicTables)
logicTables - names of logic tablespublic boolean isAllInDefaultDataSource(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.