Akigaze commented on issue #4947: Is there any way to traverse tables in the 
specified order by Schema & Table Route
URL: 
https://github.com/apache/incubator-shardingsphere/issues/4947#issuecomment-604226757
 
 
   Here is my sharding rule 
   ```java
   public class CreatedTimeShardingAlgorithm implements 
PreciseShardingAlgorithm<Date> {
   
     public static final SimpleDateFormat FORMAT = new SimpleDateFormat("yy_M");
   
     public static final String SEPARATOR = "_";
   
     @Override
     public String doSharding(Collection<String> availableTables, 
PreciseShardingValue<Date> shardingValue) {
       Date createdTime = shardingValue.getValue();
       String suffix = FORMAT.format(createdTime);
       String expectedTable = shardingValue.getLogicTableName() + SEPARATOR + 
suffix;
       return availableTables.contains(expectedTable) ? expectedTable : 
shardingValue.getLogicTableName();
     }
   }
   ```

----------------------------------------------------------------
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:
us...@infra.apache.org


With regards,
Apache Git Services

Reply via email to