Thank you for focus this issue. This idea is pretty good. We can define a SPI name as TimeService and provide a default implementation for return `new Date()` only. And then we can provide a MySQL implementation for execute `select now()`. The MySQL configuration can be configured by properties.
A suggestion for using SPI, we may not pass the SPI into `ConditionValue`, `ConditionValue` should not aware SPI about time result, please make the current date just a regular sharding value. ------------------ Liang Zhang (John) Apache ShardingSphere & Dubbo Pramy Mr <[email protected]> 于2019年10月9日周三 下午9:40写道: > hello. I want to solve the issues [1]. > I have a idea > 1. add a spi for getting date before routing, default value is return new > Date(). > > I want to add this spi into ConditionValue, return a Date when > expressionSegment is > now() expression > > Considering that the date is not accurate to the second level, the date is > allowed to have a slight error. > > [1] https://github.com/apache/incubator-shardingsphere/issues/1497 >
