Beyondeclipse edited a comment on issue #10761:
URL:
https://github.com/apache/shardingsphere/issues/10761#issuecomment-865859554
Hi @No-Silver-J
It is not that difficult to implement algorithm SPI . Please try to follow
this example:
1. Create your class implemented
org.apache.shardingsphere.sharding.api.sharding.standard.StandardShardingAlgorithm.
2. Create file "org.apache.shardingsphere.sharding.spi.ShardingAlgorithm" in
src/main/resources/META-INF/services.
3. Add your class with package in the file, like:
"xxxx.xxx.xxxx.TableAlgorithm".
4. config setting like this:
`
rules:
-
tables:
TABLE_SHARDING_DEMO:
actualDataNodes: demo_00${0..1}.TABLE_SHARDING_DEMO
databaseStrategy: &demo
standard:
shardingColumn: demo_name
shardingAlgorithmName: mod_2
shardingAlgorithms:
mod_2:
type: MOD_2 # returned value of method "getType()" in your
implemented class
props:
`
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
[email protected]