Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

improvement for better safety #1

Open
schrek1 opened this issue Nov 9, 2023 · 0 comments
Open

improvement for better safety #1

schrek1 opened this issue Nov 9, 2023 · 0 comments

Comments

@schrek1
Copy link

schrek1 commented Nov 9, 2023

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant