From e58d2d81226c4cc4110747305d083b67903d621c Mon Sep 17 00:00:00 2001 From: kim <89579420+NyaaaWhatsUpDoc@users.noreply.github.com> Date: Thu, 8 Dec 2022 17:35:14 +0000 Subject: [chore] move caches to a separate State{} structure (#1078) * move caches to a separate State{} structure Signed-off-by: kim * fix call to log.Panic not using formatted call Signed-off-by: kim * move caches to use interfaces, to make switchouts easier in future Signed-off-by: kim * fix rebase issue Signed-off-by: kim * improve code comment Signed-off-by: kim * fix further issues after rebase Signed-off-by: kim * heh Signed-off-by: kim * add missing license text Signed-off-by: kim Signed-off-by: kim --- testrig/db.go | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) (limited to 'testrig/db.go') diff --git a/testrig/db.go b/testrig/db.go index 6670b91db..508f10b76 100644 --- a/testrig/db.go +++ b/testrig/db.go @@ -28,6 +28,7 @@ import ( "github.com/superseriousbusiness/gotosocial/internal/db/bundb" "github.com/superseriousbusiness/gotosocial/internal/gtsmodel" "github.com/superseriousbusiness/gotosocial/internal/log" + "github.com/superseriousbusiness/gotosocial/internal/state" ) var testModels = []interface{}{ @@ -92,10 +93,16 @@ func NewTestDB() db.DB { }) } - testDB, err := bundb.NewBunDBService(context.Background()) + var state state.State + state.Caches.Init() + + testDB, err := bundb.NewBunDBService(context.Background(), &state) if err != nil { log.Panic(err) } + + state.DB = testDB + return testDB } -- cgit v1.2.3