From 9ad7b0e67c90697893f188323a32590fbecd5a65 Mon Sep 17 00:00:00 2001 From: Anhgelus Morhtuuzh Date: Mon, 22 Dec 2025 18:51:42 +0100 Subject: fix(storage): does not store stats if request fails --- backend/storage/db.go | 6 ++++++ 1 file changed, 6 insertions(+) (limited to 'backend/storage/db.go') diff --git a/backend/storage/db.go b/backend/storage/db.go index 7a7c6e0..0ee50da 100644 --- a/backend/storage/db.go +++ b/backend/storage/db.go @@ -13,6 +13,8 @@ import ( _ "github.com/mattn/go-sqlite3" ) +const DBKey = "db" + //go:embed migrations var migrations embed.FS @@ -66,3 +68,7 @@ func RunMigration(ctx context.Context, db *sql.DB) error { } return nil } + +func getDB(ctx context.Context) *sql.DB { + return ctx.Value(DBKey).(*sql.DB) +} -- cgit v1.2.3