<@U01SP2GJYAU> How do I define a `FROM_UNIXTIME(?)...
# komapper
d
@Toshihiro Nakamura How do I define a
FROM_UNIXTIME(?)
for mysql (to be used in a where statement:
a.field1 > FROM_UNIXTIME(?)
)?
t
This is a kind of workaround, but you can write it this way.
Copy code
private fun fromUnixTime(value: Long): ColumnExpression<LocalDateTime, LocalDateTime> {
    val name = "fromUnixTime"
    val o1 = Operand.Argument(literal(0L), value)
    return columnExpression(LocalDateTime::class, LocalDateTime::class, { it }, name, listOf(o1)) {
        append("FROM_UNIXTIME(")
        visit(o1)
        append(")")
    }
}
I’ll think about whether we can provide a better method in the next version.
d
Ok, thanks! I can give that a try.