Fix: unittests

This commit is contained in:
Grail Finder
2025-07-02 19:00:39 +03:00
parent a438d5b665
commit 130ed3763b
15 changed files with 227 additions and 245 deletions

View File

@ -1,6 +1,7 @@
package repos
import (
"context"
"log/slog"
"os"
@ -12,11 +13,11 @@ type AllRepos interface {
RoomsRepo
ActionsRepo
PlayersRepo
SessionsRepo
}
type RepoProvider struct {
DB *sqlx.DB
Ext sqlx.Ext
DB *sqlx.DB
}
func NewRepoProvider(pathToDB string) *RepoProvider {
@ -30,3 +31,11 @@ func NewRepoProvider(pathToDB string) *RepoProvider {
DB: db,
}
}
func getDB(ctx context.Context, db *sqlx.DB) sqlx.ExtContext {
if tx, ok := ctx.Value("tx").(*sqlx.Tx);
ok {
return tx
}
return db
}