evtstore
evtstore copied to clipboard
How to pass transaction to be able to rollback a sequence of actions?
I am using the evtstore library in our app and I need a way to pass transaction in knex provider in order to rollback a sequence of actions in our application. Do you have any advice for it? After a small walkthrough in codebase it seems that I need to pass it only in the append
function of the provider (where exists the only insertion in events table)
I haven't quite been able to come up with a good/elegant solution for this. I'll keep thinking about it as I think it'd be quite valuable to have.
I assume you are needing to pass an arbitrary transaction while you're invoking commands?
Correct. I have prepared a proof of concept about it on this https://github.com/Seikho/evtstore/pull/15
. Please have a look.
Do you have any feedback about it?
Apologies for the slow reply. Yes, I do. The library functions are intended to be "provider agnostic" so passing through provider-specific objects through the agnostic functions breaks that pattern.
We'll need to come up with a way to maintains the agnosticism of the library code while solving your problem.