English | 简体中文

api-docs / org.ktorm.schema / Table / bindTo

bindTo

inline fun <C : Any> Column<C>.bindTo(
    selector: (E) -> C?
): Column<C>
(source code)

Bind the column to nested properties, eg. employee.manager.department.id.

Note: Since Column is immutable, this function will create a new Column instance and replace the origin
registered one.

Parameters

selector - a lambda in which we should return the property we want to bind.
For example: val name = varchar("name").bindTo { it.name }.

Return
the new Column instance.