doUpdate

abstract fun doUpdate(setExpression: String, whereCondition: String? = null)

In case of conflict, perform an update (DO UPDATE).

Parameters

setExpression

SET expression, e.g., "counter = tbl.counter + 1". Use EXCLUDED to reference the values that were attempted to insert.

whereCondition

Optional WHERE condition for the UPDATE action.


abstract fun doUpdate(vararg setPairs: Pair<String, String>, whereCondition: String? = null)

In case of conflict, perform an update (DO UPDATE) using column-value pairs. This is the preferred way as it's more readable and less error-prone than manually assembling a string. Usage example: doUpdate( "last_login" to "NOW()", "login_attempts" to "EXCLUDED.login_attempts + 1" )

Parameters

setPairs

Pairs (column, expression) to use in the SET clause.

whereCondition

Optional WHERE condition for the UPDATE action.


abstract fun doUpdate(setMap: Map<String, String>, whereCondition: String? = null)

In case of conflict, perform an update (DO UPDATE) using a column-value map. Useful when update logic is built dynamically.

Parameters

setMap

Map {column -> expression} to use in the SET clause.

whereCondition

Optional WHERE condition for the UPDATE action.