In my create
, read
, update
, and delete
functions, I am returning true
if the transaction was successful and false
otherwise - except for read
, where I return the requested data
or null
.
This strategy should make testing easy due to simply assessing the return value given various test inputs to a test database.
My problem is that I cannot fully determine whether the transaction was successful until db.query("...")
completes and its callback is invoked, but, by this time,the original CRUD function has returned.
What is the common practice?