import {
update
} from 'slonik-utilities';
/**
* @param connection Instance of Slonik connection.
* @param {string} tableName Target table name.
* @param {Object.<string, ValueExpression>} namedValueBindings Object describing the desired column values.
* @param {Object.<string, EqualPredicate>} [booleanExpressionValues] Object describing the boolean expression used to construct WHERE condition.
* @returns {UpdateResultType}
*/
update;
Constructs and executes UPDATE
query.
Operation:
update(
connection,
'user',
{
givenName: 'foo'
}
);
Is equivalent to:
UPDATE "user"
SET
"given_name" = $1;
Operation:
update(
connection,
'user',
{
givenName: 'foo'
},
{
lastName: 'bar'
}
);
Is equivalent to:
UPDATE "user"
SET
"given_name" = $1
WHERE
"last_name" = $2;