使用这个
createdAt TIMESTAMP AS LocalDateTime NOT NULL,
编译但适配器永远不会在 postgres 中从 localdatetime 转换为 TIMESTAMP。相反,我收到
Exception in thread "AWT-EventQueue-0" org.postgresql.util.PSQLException: ERROR: column "createdat" is of type timestamp without time zone but expression is of type character varying
Hint: You will need to rewrite or cast the expression.
我认为这是一个错误,但我先在这里询问是否有人有任何想法,然后再在 github 上提交错误报告。谢谢。
val localDatetimeColumnAdapter = object : ColumnAdapter<LocalDateTime,String> {
override fun decode(databaseValue: String) =
LocalDateTime.parse(databaseValue)
override fun encode(value: LocalDateTime) = value.toString()
kotlin_version = 1.3.41
sqldelight_version = 1.5.0
hikari_cp_version = 4.0.3
postgresql_version = 42.2.20