insert
fun <T : BaseTable<*>> Database.insert(table: T, block: AssignmentsBuilder.(T) -> Unit): Int(source)
Construct an insert expression in the given closure, then execute it and return the effected row count.
Usage:
database.insert(Employees) {
set(it.name, "jerry")
set(it.job, "trainee")
set(it.managerId, 1)
set(it.hireDate, LocalDate.now())
set(it.salary, 50)
set(it.departmentId, 1)
}
Content copied to clipboard
Since
2.7
Return
the effected row count.
Parameters
table
the table to be inserted.
block
the DSL block, an extension function of AssignmentsBuilder, used to construct the expression.