The adapter with lifecycle hooks around its calls, on any adapter.
onBeforeQuery (get, all, exec) and onBeforeWrite (run) see the call's context, and return it, changed or
not, to go on, or undefined to stop the call: a stopped get returns null, all an empty list, run no changes.
onAfterQuery can replace the result, and onAfterWrite sees it.
onBeforeTransaction can stop a transaction, and onAfterTransaction sees its outcome. The statements inside a
transaction pass through the hooks too.
onError sees each failure and returns the error to throw, or undefined to swallow it.
Everything else, the adapter's kind and its own methods (withConnection on PostgreSQL), reaches the adapter
itself, and instanceof still names its class.
The adapter with lifecycle hooks around its calls, on any adapter.
onBeforeQuery(get, all, exec) andonBeforeWrite(run) see the call's context, and return it, changed or not, to go on, or undefined to stop the call: a stopped get returns null, all an empty list, run no changes.onAfterQuerycan replace the result, andonAfterWritesees it.onBeforeTransactioncan stop a transaction, andonAfterTransactionsees its outcome. The statements inside a transaction pass through the hooks too.onErrorsees each failure and returns the error to throw, or undefined to swallow it.Everything else, the adapter's kind and its own methods (
withConnectionon PostgreSQL), reaches the adapter itself, andinstanceofstill names its class.