const chunks: SQL[] = [];
chunks.push(tx.update(myTable).set({ nameInJS: 'John Doe' }).getSQL());
chunks.push(sql`from ${anotherTable}`);
chunks.push(sql`where ${eq(myTable.idInJS, anotherTable.idInJS)}`);
chunks.push(sql`returning *`);
const updateSql = sql.join(chunks, sql.raw(' '));
const { rows } = await tx.execute(updateSql);
/**
* rows = [ { id_in_sql: 0, name_in_sql: 'John Doe' } ]
*
* Need: [ { idInJS: 0, nameInJS: 'John Doe' } ]
*/
const chunks: SQL[] = [];
chunks.push(tx.update(myTable).set({ nameInJS: 'John Doe' }).getSQL());
chunks.push(sql`from ${anotherTable}`);
chunks.push(sql`where ${eq(myTable.idInJS, anotherTable.idInJS)}`);
chunks.push(sql`returning *`);
const updateSql = sql.join(chunks, sql.raw(' '));
const { rows } = await tx.execute(updateSql);
/**
* rows = [ { id_in_sql: 0, name_in_sql: 'John Doe' } ]
*
* Need: [ { idInJS: 0, nameInJS: 'John Doe' } ]
*/