com.github.drinkjava2.jsqlbox.sharding
Class ShardingModTool
java.lang.Object
com.github.drinkjava2.jsqlbox.sharding.ShardingModTool
- All Implemented Interfaces:
- ShardingTool
public class ShardingModTool
- extends Object
- implements ShardingTool
An simple implementation of ShardingTool to deal "MOD" type sharding strategy
- Since:
- 1.7.0.3
- Author:
- Yong Zhu
| Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
ShardingModTool
public ShardingModTool()
handleShardTable
public String[] handleShardTable(SqlBoxContext ctx,
TableModel model,
Object... shardkey)
- Description copied from interface:
ShardingTool
- Dealing a SqlItem(SqlOption.SHARD_TABLE, entityOrClass, shardKey1,
optionalShardKey2) item, return real table names array
- Specified by:
handleShardTable in interface ShardingTool
- Parameters:
ctx - Current SqlBoxContext instanceshardkey - The shard key or keys
- Returns:
- A String[] stored table names or null if the sharding strategy is not
fit for current implementation
handleShardDatabase
public SqlBoxContext[] handleShardDatabase(SqlBoxContext ctx,
TableModel model,
Object... shardkey)
- Description copied from interface:
ShardingTool
- Dealing a ShardTable SqlItem, return real master SqlBoxContexts array
- Specified by:
handleShardDatabase in interface ShardingTool
- Parameters:
ctx - Current SqlBoxContext instanceshardkey - The shard key or keys
- Returns:
- A SqlBoxContext[] stored master SqlBoxContexts or null if the
sharding strategy is not fit for current implementation
Copyright © 2018. All rights reserved.