values
Add a VALUES (...), (...) clause, binding every element as a parameter.
client.sql {
+"INSERT INTO users (username, email)"
values(listOf(
listOf("user1", "user1@example.com"),
listOf("user2", "user2@example.com"),
))
}Content copied to clipboard
Parameters
input
rows of values; each child list corresponds to one row
Throws
if input is empty, a child list is empty, or the child lists do not all have the same size
Add a VALUES (...), (...) clause, converting each element of input into a row using transformer.
client.sql {
+"INSERT INTO users (username, email)"
values(users) { listOf(it.username, it.email) }
}Content copied to clipboard
Parameters
input
objects to insert; each element corresponds to one row
transformer
converts an element into the list of values for its row
Throws
if input is empty, transformer returns an empty list, or the returned lists do not all have the same size