db: Add generic interoperable base store
Created by: efritz
This closes https://github.com/sourcegraph/sourcegraph/issues/11678 by implementing a base store implementation that abstracts over queries and transactions, and that can share the underlying database handle with other stores.
This is a solution that allows multiple stores that add domain logic via composition/decoration to share an underlying transaction (such as campaigns and code intel needing to fetch/update repository data in a transaction outside of the frontend).
This abstract base store is meant to be used compositionally (nested inside another store instance). See inline comments or the changes within the enterprise/internal/codeintel/store package, which uses the new store, for usage instructions.
Note: This is part of a cleanup process which won't be done immediately, so there may be some duplicate implementation here and there while we address the bigger concerns (things like scanning, Tx interfaces, etc). Don't worry too much about these at this point. Feel free to log concerns that come up as issues under the umbrella tech debt issue https://github.com/sourcegraph/sourcegraph/issues/11676.