convertIf

abstract fun convertIf(condition: (fromType: KType, toSchema: ColumnSchema) -> Boolean, converter: ConverterScope.(Any?) -> Any?)

Advanced version of convert. If you want to define a common conversion for multiple types (or any type), or you need extra information about the target, such as its schema, use this method.

The exact type conversion does have higher priority. After that, these flexible conversions will be checked in order.

For more information: See convertTo on the documentation website.

Parameters

condition

a function that should return true if the conversion should be applied from the given fromType to the given toSchema.

converter

a function that performs the conversion with access to a ConverterScope.