Skip to content
This repository was archived by the owner on Mar 12, 2025. It is now read-only.
This repository was archived by the owner on Mar 12, 2025. It is now read-only.

improvement for better safety #1

@schrek1

Description

@schrek1

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions