How to use a prepared query inside a transaction?

I have a prepared query like this:
const userAddressBookQuery = db.query.userAddressTable
  .findMany({
    where: (fields) => eq(fields.userId, sql.placeholder('userId')),
  })
  .prepare('user_address_book');

I want to use this inside a db.transaction(async (tx) => { ... }) block.

what's the correct way to use .prepare() inside a transaction?
Was this page helpful?