• 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.

    Type Parameters

    Parameters

    Returns A