[data.update]

data.update is a slot in the data namespace, in Hyperlambda, the language of Magic Cloud. Updates rows in the current open database connection; use [where] to constrain affected rows.

  • Returns: Resolves to the number of rows affected
  • Scope: requires data.connection - Requires an open database connection created by [data.connect]

Arguments

Required arguments come first, then the optional ones in the order they are declared.

Argument Type Required Description
[table] string yes Table name to use in the SQL statement.
[values] lambda yes Column values to insert or update.
[values] / any node name object yes Column name and value. Can be repeated.
[where] lambda yes Required boolean predicate tree — destructive SQL must constrain affected rows.
[where] / [and] lambda no Boolean AND group.
[where] / [and] / any node name object yes Column condition; suffix the name with .eq, .neq, .gt, .gte, .lt, .lte, .like, .ilike, or .in to select an operator. Can be repeated.
[where] / [and] / any node name / unnamed child node object no Value item used by operators such as .in.
[where] / [and] / [or] lambda no Boolean OR group. Can be repeated.
[where] / [and] / [or] / any node name object yes Column condition; suffix the name with .eq, .neq, .gt, .gte, .lt, .lte, .like, .ilike, or .in to select an operator. Can be repeated.
[where] / [and] / [or] / any node name / unnamed child node object no Value item used by operators such as .in.
[where] / [or] lambda no Boolean OR group.
[where] / [or] / any node name object yes Column condition; suffix the name with .eq, .neq, .gt, .gte, .lt, .lte, .like, .ilike, or .in to select an operator. Can be repeated.
[where] / [or] / any node name / unnamed child node object no Value item used by operators such as .in.
[where] / [or] / [and] lambda no Boolean AND group. Can be repeated.
[where] / [or] / [and] / any node name object yes Column condition; suffix the name with .eq, .neq, .gt, .gte, .lt, .lte, .like, .ilike, or .in to select an operator. Can be repeated.
[where] / [or] / [and] / any node name / unnamed child node object no Value item used by operators such as .in.
[database-type] string no Database adapter to use instead of the configured default.
[generate] bool no Whether to only generate SQL and parameter nodes instead of executing it. Default: false.

Nodes nested deeper than 6 levels, and nodes that repeat one of their own ancestors, are not listed. The JSON declaration below has all of them.

Guide: How to use [data.update]

JSON declaration

This is the complete declaration of data.update, as the running system describes it. It is also published as slot.json.

JSON declaration (loads when opened)

← data.transaction.rollback all data.* slots