complone commented on issue #17752:
URL: 
https://github.com/apache/shardingsphere/issues/17752#issuecomment-1132365851

   > * My intuitive understanding is that once we decide to introduce a class 
like `java.time.LocalDate` in `IntervalShardingAlgorithm`, the corresponding 
`JDBC Type` is not a `Timestamp` class, then `LocalDateTime` should not be 
forced to be defined in `IntervalShardingAlgorithm`, but with the help of Its 
superclass or specific interface to help us deal with incoming classes, which 
more needs to take into account the ` private static final String 
DATE_TIME_PATTERN_KEY = "datetime-pattern";` in the configuration.
   > * update: It seems that [Support for advanced IntervalShardingAlgorithm 
#17814](https://github.com/apache/shardingsphere/issues/17814) is trying to do 
string matching on the datetime-pattern or actualdatanodes of 
IntervalShardingAlgorithm, I would like to see his approach first and then deal 
with the string matching problem of this issue.
   
   @linghengqian
   By reading the issue, I sorted out some key information
   For example, there are some new APIs in Java8, LocalDate, LocalTime, 
LocalDateTime
   But by default, the time and date of java8 is not supported in mybatis
   
   The general approach is based on the different typehandlers provided by 
mybatis based on the package mybatis-typehandlers-jsr310
   Complete the conversion of various java types to mysql types, but the 
principle of typehandler is
   Based on a registered factory for the TypeHandlerRegistry class, the 
commonly used converters are initialized by default in this class,
   There are the following two Maps in the member variables, among which 
JDBC_TYPE_HANDLER_MAP This map is for the conversion of jdbc to Java class,
   
   
   After looking around I think LocalDateTime is a superior abstraction of 
LocalDate
    There is an intermediary between ChronoLocalDateTime and 
ChronoLocalDateLocalTime to query the specific time point
    Termquery is a functional interface annotated with @FunctionalInterface
   Queries are key tools for extracting information from temporal objects. 
According to the strategy design pattern,
   The purpose is to externalize the query process, allowing different methods 
to be used
   Termquery: 
https://docs.oracle.com/javase/9/docs/api/java/time/temporal/TemporalQuery.html
   
   In order to mask the underlying details as much as possible, I found a 
solution based on java api Termquery.
   
   Here is an example of time transformation in graphsql: 
https://github.com/smallrye/smallrye-graphql/blob/main/server/implementation/src/main/java/io/smallrye/graphql/transformation/LegacyDateTransformer.
 java
   
   Hope it helps your work
   
   


-- 
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.

To unsubscribe, e-mail: notifications-unsubscr...@shardingsphere.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org

Reply via email to