@faasjs/pg / sql
Variable: sql
constsql: (strings, ...values) =>SqlExpression&object
Creates a parameterized SQL expression for QueryBuilder.update.
Use sql.ref for identifiers. All other interpolated values are converted to bound parameters; never concatenate runtime input into the static template text.
Type Declaration
ref
ref: (
identifier) =>SqlReference
Creates an escaped SQL identifier reference for interpolation into sql.
Parameters
identifier
string
Returns
Example
await client
.query('jobs')
.where('id', id)
.update({
attempts: sql`${sql.ref('attempts')} + ${1}`,
updated_at: sql`NOW()`,
})