https://kotlinlang.org logo
#exposed
Title
# exposed
s

Sahit Sadono

03/28/2024, 5:25 AM
Hi everyone, is it possible to add this typecast in custom ColumnType before inserting value to database ?
c

Chantal Loncle

03/28/2024, 2:00 PM
Hi @Sahit Sadono Depending on the logic in your custom
ColumnType
, a good place to add the type cast would be in
nonNullValueToString()
, something like:
Copy code
override fun nonNullValueToString(value: Any): String {
    return "${super.nonNullValueToString(value)}::geography"
}
This should add the typecast whenever an input value is provided to the column for processing before being sent to the database, so inserts and updates.
s

Sahit Sadono

03/29/2024, 4:51 AM
hi @Chantal Loncle , thank you so much. it works
👍 1