better-sqlite3 icon indicating copy to clipboard operation
better-sqlite3 copied to clipboard

General callback after any successful action ?

Open zedtux opened this issue 2 years ago • 2 comments

First of all, thank you for this library 👍.

I'm brainstorming the synching of two instances of my app, and one option could be to replicate each data successfully inserted in the database so that the other instance can apply the updates too.

Is there any kind of global callback which would be triggered on a successful db.transaction(), insert, update, or destroy ?

zedtux avatar May 03 '22 14:05 zedtux

I don't believe this is built-in.

I wrapped all DB calls to go through a wrapper class that ensures the db is open, handles nested transactions, and catches and logs all db errors. I'd suggest that approach: you then have as much flexibility as you need.

mceachen avatar May 13 '22 18:05 mceachen

Thank you for your comment

zedtux avatar May 13 '22 20:05 zedtux