Structure
SQLUpdate
An expression representing an
UPDATE query. Used to modify existing rows in a single table.struct SQLUpdate
Overview
UPDATE "table" SET
"column1"=$0,
"column2"=$1
WHERE
"column3"!=$2
RETURNING
"id"
;
Because of the radically different syntax required for “multi-table” updates between dialects, additional dialect support would be required to implement this functionality; this is planned for the next major update to SQLKit.
See SQLUpdateBuilder.
Topics
Initializers
init(table: any SQLExpression)Create a new row modification query.
Instance Properties
var predicate: (any SQLExpression)?If notnil, a predicate which describes the row(s) to be updated.var returning: SQLReturning?An optionalSQLReturningclause specifying data to return from the updated rows.var table: any SQLExpressionThe table containing the row(s) to be updated.var tableExpressionGroup: SQLCommonTableExpressionGroup?An optional common table expression group.var values: [any SQLExpression]One or more column assignment expressions describing how to update the value in each affected row.
Instance Methods
func serialize(to: inout SQLSerializer)Invoked when a request is made to serialize the expression to raw SQL.
Relationships
Conforms To
SQLExpressionSwift.SendableSwift.SendableMetatype
See Also
Query Expressions
struct SQLAlterEnumAn expression representing anALTER TYPEquery. Used to add new cases to enumeration types.struct SQLAlterTableAn expression representing anALTER TABLEquery. Used to modify the structure of existing tables.struct SQLCreateEnumAn expression representing aCREATE TYPEquery. Used to create enumeration types.struct SQLCreateIndexAn expression representing aCREATE INDEXquery. Used to add indexes over columns to an existing table.struct SQLCreateTableAn expression representing aCREATE TABLEquery. Used to create new tables.struct SQLCreateTriggerAn expression representing aCREATE TRIGGERquery. Used to create new triggers for actions on a table.struct SQLDeleteAn expression representing aCREATE TRIGGERquery. Used to remove rows from a table.struct SQLDropEnumAn expression representing aDROP TYPEquery. Used to delete enumeration types.struct SQLDropIndexAn expression representing aDROP INDEXquery. Used to delete indexes from tables.struct SQLDropTableAn expression representing aDROP TABLEquery. Used to delete entire tables.struct SQLDropTriggerAn expression representing aDROP TRIGGERquery. Used to delete triggers.struct SQLInsertAn expression representing anINSERTquery. Used to add new rows to a table.struct SQLSelectAn expression representing aSELECTquery. Used to retrieve rows and expression results from a database.struct SQLUnionAn expression representing two or moreSELECTqueries joined byUNIONclauses. Used to merge the results of multiple queries into a single result set.