UpdateQueryBuilder
Defines the public API for building SQL UPDATE queries.
// Promote a legionnaire and record the timestamp
dataAccess.update("legionnaires")
.setValue("rank")
.setExpression("promoted_at", "NOW()")
.where("id = @id")
.returning("*")
.toSingleOf<Legionnaire>("rank" to Rank.Optio, "id" to legionnaireId)Functions
Converts this builder to a StepBuilderMethods for lazy execution within a TransactionPlan.
Switches the builder to streaming mode, optimal for large datasets.
Switches the builder to asynchronous mode. Requires providing a CoroutineScope in which callback will be launched.
Creates and returns a deep copy of this builder. Useful for creating query variants from a shared base without modifying the original.
Adds a FROM clause to the UPDATE query.
Marks the WITH clause as recursive.
Adds a RETURNING clause. Requires using methods like .toList(), .toSingle(), etc. instead of .execute().
Defines a single assignment in the SET clause using a raw SQL expression.
Defines assignments in the SET clause using raw SQL expressions.
Defines a single assignment in the SET clause. Automatically generates a placeholder with the key name.
Sets values to update. Automatically generates placeholders in @value format for each value in the list.
Sets values to update. Automatically generates placeholders in @key format for each key in the map. Values from the map must be passed in the terminal method (e.g., .execute()).
Fetches a single value from the first column of the first row. Always returns Failure if no rows are found, regardless of nullability. Nullability only controls whether a null value in the column is allowed: use toFieldStrict<Int>() to fail on null, or toFieldStrict<Int?>() to allow null values.
Maps results to a list of objects of the given type. Requires that column names/aliases in SQL (in snake_case convention) match property names in the target class (in camelCase convention) or have a @MapKey annotation with the stored column name.
Convenient inline extension function for toListOf. Uses reified to automatically infer the target type.
Maps the result to a single object of the given type. Works on the same mapping principle as toListOf. Nullability is determined by the KType: use toSingleOf<User>() for non-null or toSingleOf<User?>() for nullable results.
Convenient inline extension function for toSingleOf. Uses reified to automatically infer the target type.
Fetches a single row as Map
Defines the WHERE condition. The clause is mandatory for security reasons.
Adds a Common Table Expression (CTE) to the query.