fun Builder.mappedValues(vararg entries: Pair<String, Any?>): Builder
Extension function of InsertBuilder allowing to specify values as columns/value pairs instead of a Map.
Example usage:
insertInto("user") {
columns("id", "name", "birthDate")
mappedValues("id" to 1, "name" to "John Doe")
}
This is equivalent to
insertInto("user") {
columns("id", "name", "birthDate")
values(mapOf("id" to 1, "name" to "John Doe"))
}
but is a bit shorter. Beware to NOT use
insertInto("user") {
columns("id", "name", "birthDate")
values("id" to 1, "name" to "John Doe")
}
because that would try to insert the Pairs themselves into the table, rather than the values of the pairs.
entries
- the column/value pairs of the row to insertReturn
the Insert Builder for chaining (although that is usually not necessary with the Kotlin DSL)
Author
JB Nizet