question about transaction isolation level
I am not sure if the way I do queries with transaction with kysely is the right way. I would be glad if someone could take a look:
3 Replies
That won't work. Kysely takes a new connection from the pool for each query. What you have will run begin, commit and rollback on separate connections.
See the
db.transaction
method and corresponding documentation. The API docs have a bunch of examples, and there's some in kysely.dev too.thanks for the quick reply
I've done some reading on docs, and I have one more question:
executing raw queries this way is fine, right?
sorry im not able to format better this code part on discord
Yep, that's fine