ConvertSchemaDsl
Dsl to customize column conversion
Example:
df.convertTo<SomeSchema> {
// defines how to convert Int? -> String
convert<Int?>().with { it?.toString() ?: "No input given" }
// defines how to convert String/Char -> SomeType
parser { SomeType(it) }
// fill missing column `sum` with expression `a+b`
fill { sum }.with { a + b }
}Content copied to clipboard
For more information: See convertTo on the documentation website.
Inheritors
Functions
Link copied to clipboard
Defines how to convert values of the given type C.
Link copied to clipboard
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.
Link copied to clipboard
inline fun <T, reified C> ConvertSchemaDsl<T>.fill(noinline columns: ColumnsSelector<T, C>): ConvertToFill<T, C>