メソッド
await db.tx(async t => {
const id = await t.one('INSERT INTO table1(a, b) VALUES($1, $2) RETURNING id', [1, 2], a => +a.id);
await t.none('INSERT INTO table2(id, a_id) VALUES($1, $2)', [1, id]);
});
メソッド
await db.tx(async t => {
const id = await t.one('INSERT INTO table1(a, b) VALUES($1, $2) RETURNING id', [1, 2], a => +a.id);
await t.none('INSERT INTO table2(id, a_id) VALUES($1, $2)', [1, id]);
});