const fieldsToUpdate = [
{
name: 'name',
value: input.name,
},
// ...
];
await pool.query(sql`
UPDATE user_account
SET
${sql.join(
fieldsToUpdate.map(({ name, value }) => {
return sql`${sql.identifier([name])} = ${value}`;
}),
sql`,`
)}
WHERE id = ${userAccountId}
`);