English | 简体中文

api-docs / org.ktorm.global / update

update

fun <T : BaseTable<*>> T.update(
    block: UpdateStatementBuilder.(T) -> Unit
): Int
(source code)

Construct an update expression in the given closure, then execute it and return the effected row count.

Usage:

Employees.update {
set(it.job, "engineer")
set(it.managerId, null)
set(it.salary, 100)
where {
it.id eq 2
}
}

Parameters

block - the DSL block, an extension function of UpdateStatementBuilder, used to construct the expression.

Return
the effected row count.