planetscale/database-js

First class support for transactions

mattrobenolt opened this issue · 0 comments

I don't want to speculate on what an API for this could be, since I think this is more fitting to precedent within the ecosystem and expectations, but it's not clear or obvious that you can do transactions through database-js, so we should provide some examples and likely some conn.beginTransaction(), etc, helpers.

To be clear, you can simply do:

await conn.execute('begin')
await conn.execute('select 1')
await conn.execute('commit')

and this works fine, as long as it's on the same session.