Skip to content

DB Backend: embed `dbutil.DB` in `TransactableHandle`

Warren Gifford requested to merge cc/embed-dbutil-db into main

Created by: camdencheek

Ths embeds dbutil.DB in TransactableHandle so it doesn't need to be unwrapped to a dbutil.DB before use. This enables two things:

  1. It can be mocked. There are a couple of places where we override the behavior of Transact for the purpose of tests, so this makes it possible to keep this pattern with the new well-typed TransactableHandles.
  2. The TransactableHandle now has full control over all database calls, so it can now report when transactions are used concurrently.

Stacked on https://github.com/sourcegraph/sourcegraph/pull/37163

Test plan

This just moves things to an embedding rather than a method and should be completely safe. Depending on gopls, but if tests pass I'm happy

Merge request reports

Loading