If I'm writing an extension function for transform...
# exposed
d
If I'm writing an extension function for transforming a column like this
Copy code
fun Column<Long>.transformInstant(): ColumnWithTransform<Long, Instant> =
    this.transform({ it.toEpochMilli() }, { Instant.ofEpochMilli(it) })
I'm forced to import a specific Table, like import <package>.data.accounts.Account.Companion.transform Is there a built-in Instant transform, or do I really need to tie this extension to a specific table?
a
I think this should work!
Copy code
fun Column<Long>.epochInstant() = ColumnWithTransform(
    column = this,
    toReal = Instant::ofEpochSecond,
    toColumn = Instant::getEpochSecond
)
There is a
exposed-java-time
module to add support for java.time. But I don't think it supports epoch format.
d
Oh.. I have no idea why I didn't think of returning the actual class. So much better than including some dumb dummy table in the utility file... thanks a ton!
🙂 1