Callback-free interactive transactions
See original GitHub issueProblem
Some users are asking for a less restricted way for opening an interactive transaction. Instead of having a callback for the transaction, there would be manual calls to $begin
, $commit
, and $rollback
.
Suggested solution
Example of a use-case
describe('some test', () => {
let trx: Transaction;
beforeEach(async () => {
trx = await prisma.$begin();
jest.mock('./prisma', () => trx);
});
afterEach(async () => {
await trx.$rollback();
});
it('.....', () => {
// ....
});
});
Alternatives
Additional context
https://github.com/prisma/prisma/issues/1844#issuecomment-1067348856
Issue Analytics
- State:
- Created 2 years ago
- Reactions:23
- Comments:14 (5 by maintainers)
Top Results From Across the Web
Transactions and batch queries (Reference) - Prisma
Interactive transactions : pass a function that can contain user code including Prisma Client queries, non-Prisma code and other control flow to be...
Read more >Online Detection of Effectively Callback Free Objects with ...
is inspired by conflict serializability of database transactions. The main idea is to explore commuta- tivity of operations for efficient online checking of ......
Read more >Online Detection of Effectively Callback Free Objects ... - arXiv
Notice that the ECF notion is similar to the notion of atomic transactions in concurrent systems. Indeed, despite the fact that contract ...
Read more >Online detection of effectively callback ... - ACM Digital Library
Callbacks are essential in many programming environments, but drastically complicate program understanding and reasoning because they allow ...
Read more >Using Automated Reasoning Techniques for Enhancing the ...
As regards efficiency, due to the huge volume of transactions, the cost and ... Online detection of effectively callback free objects with ...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
Hey folks, I prototyped something today (with type safety!). Do you mind giving it a try and share your feedback?
Prototype setup
Example
Hey everyone, I am excited to share that we are working on a new proposal that will help in solving this. While we are not keen to add this to our API, we are very willing to allow you to create and share custom extensions. This is how you would do it:
We would love to see what you can build with Prisma Client Extensions. I’d appreciate if you can take some time to read and share your feedback on the proposal.