nullTransform

@JvmName(name = "nullTransform")
fun <Unwrapped : Any, Wrapped : Any> Column<Unwrapped>.nullTransform(wrap: (Unwrapped) -> Wrapped?, unwrap: (Wrapped?) -> Unwrapped): Column<Wrapped?>

Applies a special transformation that allows a non-nullable database column to accept and/or return values as null on the client side.

This transformation does not alter the column's definition in the database, which will still be NON NULL. It enables reflecting non-null values from the database as null in Kotlin (e.g., converting an empty string from a non-nullable text column, empty lists, negative IDs, etc., to null).

Return

A new column of type Wrapped? with the applied transformations.

Parameters

Wrapped

The type into which the value of the underlying column will be transformed.

Unwrapped

The type of the original column.

wrap

A function to transform from the source type Unwrapped to the target type Wrapped.

unwrap

A function to transform from the target type Wrapped to the source type Unwrapped.


Applies a special transformation that allows a non-nullable database column to accept and/or return values as null on the client side.

This transformation does not alter the column's definition in the database, which will still be NON NULL. It enables reflecting non-null values from the database as null in Kotlin (e.g., converting an empty string from a non-nullable text column, empty lists, negative IDs, etc., to null).

Return

A new column of type Wrapped? with the applied transformations.

Parameters

Wrapped

The type into which the value of the underlying column will be transformed.

Unwrapped

The type of the original column.

transformer

An instance of ColumnTransformer to handle the transformations.