Closed
Description
environment
jasync-r2dbc-mysql version: 1.1.7
<!-- r2dbc mysql -->
<dependency>
<groupId>com.github.jasync-sql</groupId>
<artifactId>jasync-r2dbc-mysql</artifactId>
<version>1.1.7</version>
</dependency>
insert into database report this error:
Caused by: java.lang.UnsupportedOperationException: An operation is not implemented: couldn't find mapping for class java.time.LocalDateTime
at com.github.jasync.sql.db.mysql.binary.BinaryRowEncoder.encoderFor(BinaryRowEncoder.kt:100) ~[jasync-mysql-1.1.7.jar:na]
at com.github.jasync.sql.db.mysql.encoder.PreparedStatementExecuteEncoder.encodeValue(PreparedStatementExecuteEncoder.kt:62) ~[jasync-mysql-1.1.7.jar:na]
at com.github.jasync.sql.db.mysql.encoder.PreparedStatementExecuteEncoder.encodeValues(PreparedStatementExecuteEncoder.kt:46) ~[jasync-mysql-1.1.7.jar:na]
at com.github.jasync.sql.db.mysql.encoder.PreparedStatementExecuteEncoder.encode(PreparedStatementExecuteEncoder.kt:27) ~[jasync-mysql-1.1.7.jar:na]
at com.github.jasync.sql.db.mysql.codec.MySQLOneToOneEncoder.encode(MySQLOneToOneEncoder.kt:67) ~[jasync-mysql-1.1.7.jar:na]
at com.github.jasync.sql.db.mysql.codec.MySQLOneToOneEncoder.encode(MySQLOneToOneEncoder.kt:23) ~[jasync-mysql-1.1.7.jar:na]
at io.netty.handler.codec.MessageToMessageEncoder.write(MessageToMessageEncoder.java:89) ~[netty-codec-4.1.58.Final.jar:4.1.58.Final]
... 33 common frames omitted
this is my entity example
import java.time.LocalDateTime;
public class MyEntity {
/**
* 创建时间
*/
private LocalDateTime createTime;
/**
* 更新时间
*/
private LocalDateTime updateTime;
}
I saw this part of the code for the BinaryRowEncoder
fun encoderFor(v: Any): BinaryEncoder {
return this.encoders.getOrElse(v::class.java) {
return when (v) {
is CharSequence -> this.stringEncoder
is java.math.BigInteger -> this.stringEncoder
is BigDecimal -> this.stringEncoder
is ReadableDateTime -> DateTimeEncoder
is ReadableInstant -> ReadableInstantEncoder
is LocalDateTime -> LocalDateTimeEncoder
is java.sql.Timestamp -> SQLTimestampEncoder
is java.sql.Date -> SQLDateEncoder
is java.util.Calendar -> CalendarEncoder
is LocalDate -> LocalDateEncoder
is LocalTime -> LocalTimeEncoder
is java.sql.Time -> SQLTimeEncoder
is Duration -> DurationEncoder
is java.util.Date -> JavaDateEncoder
is ByteBuffer -> ByteBufferEncoder
is ByteBuf -> ByteBufEncoder
else -> XXX("couldn't find mapping for ${v::class.java}")
}
}
}
can add support for java.time.LocalDateTime ?