onConflict

open override fun onConflict(config: OnConflictClauseBuilder.() -> Unit): InsertQueryBuilder

Configures the ON CONFLICT clause in a fluent and safe manner.

// Re-enlist a legionnaire under the same legion — update their rank if the record already exists
dataAccess.insertInto("legionnaires")
.values(data)
.onConflict {
onColumns("name", "legion_id")
doUpdate(
"rank" to "EXCLUDED.rank",
"re_enlisted_at" to "NOW()"
)
}
.execute(data)