Back to Exposed

transform

docs/api/exposed-dao/org.jetbrains.exposed.v1.dao/-entity-class/transform.html

1.2.03.1 KB
Original Source

transform

fun <Unwrapped, Wrapped> Column<Unwrapped>.transform(transformer: ColumnTransformer<Unwrapped, Wrapped>): EntityFieldWithTransform<Unwrapped, Wrapped>

Returns a EntityFieldWithTransform delegate that transforms this stored Unwrapped value on every read.

Parameters

transformer

An instance of ColumnTransformer to handle the transformations.

Samples

org.jetbrains.exposed.v1.tests.shared.entities.TransformationsTableorg.jetbrains.exposed.v1.tests.shared.entities.TransformationEntity


fun <Unwrapped, Wrapped> Column<Unwrapped>.transform(unwrap: (Wrapped) -> Unwrapped, wrap: (Unwrapped) -> Wrapped): EntityFieldWithTransform<Unwrapped, Wrapped>

Returns a EntityFieldWithTransform delegate that transforms this stored Unwrapped value on every read.

Parameters

unwrap

A pure function that converts a transformed value to a value that can be stored in this original column type.

wrap

A pure function that transforms a value stored in this original column type.

Samples

org.jetbrains.exposed.v1.tests.shared.entities.TransformationsTableorg.jetbrains.exposed.v1.tests.shared.entities.TransformationEntity


fun <TColumn, Unwrapped, Wrapped> EntityFieldWithTransform<TColumn, Unwrapped>.transform(unwrap: (Wrapped) -> Unwrapped, wrap: (Unwrapped) -> Wrapped): EntityFieldWithTransform<TColumn, Wrapped>

Returns a EntityFieldWithTransform that extends transformation of existing EntityFieldWithTransform.

Parameters

unwrap

A function that transforms the value to the wrapping type of previously defined transformation

wrap

A function that transforms value to the wrapping type

Samples

org.jetbrains.exposed.v1.tests.shared.entities.TransformationsTableorg.jetbrains.exposed.v1.tests.shared.entities.TransformationEntity

Generated by Dokka © 2026 Copyright