ExposedPowerUtils
ExposedPowerUtils copied to clipboard
improvement for better safety
At this line, I recommend you to use the following code.
https://github.com/PerfectDreams/ExposedPowerUtils/blob/bbde850bb7e19da71e5f28b0d129de7ab731ac3c/postgres-java-time/src/main/kotlin/net/perfectdreams/exposedpowerutils/sql/javatime/JavaTimestampWithTimeZoneColumnType.kt#L25C11-L25C60
return "'${dateTimeStringFormatter.format(value)}'"
it is not good by that formatter, because it put into database without zulu timezone (postfix Z) e.g: original - 2023-11-09T20:40:33.152196800 vs better - 2023-11-09T20:40:33.152196800Z
it could be done by:
override fun nonNullValueToString(value: Any): String = when (value) {
!is Instant -> error("$value is not an Instant!")
else -> "'$value'"
}
And why?
Because when I use it in bare-composed query when I use columnType.valueToString(value)
and db take time as local time, not as Zulu time.