Complex async/control flow question - kysely transactions

I'm at a loss as to how I would accomplish the following. I want to pass the transaction object from Kysely to an effect as described by the comments below. Made a bit tricky due to the combination of a promise AND callback API style. Any help would be greatly appreciated!

await db.transaction().execute(async function(tx) {
  // I need to "send" this tx back to an effect to be used
  // then I need to "wait" here, until everyone is done using this `tx`
  // then I either commit or rollback the transaction, depending on if there errors in the Effect pipeline that used the `tx`
});
Was this page helpful?