From 1ee99fc16583e4cefc46011dbc63ca8ed91d3189 Mon Sep 17 00:00:00 2001 From: kim <89579420+NyaaaWhatsUpDoc@users.noreply.github.com> Date: Thu, 31 Aug 2023 10:46:15 +0100 Subject: [bugfix] wrap bun.Tx to add our own error processing (#2169) * wrap bun.Tx to add our own error processing Signed-off-by: kim * add compile-time check for updateRowError() compatibility with sql.Row, fix wrapTx() not being used properly Signed-off-by: kim --------- Signed-off-by: kim --- internal/db/bundb/status.go | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'internal/db/bundb/status.go') diff --git a/internal/db/bundb/status.go b/internal/db/bundb/status.go index 0e97d32cc..26f0c1f38 100644 --- a/internal/db/bundb/status.go +++ b/internal/db/bundb/status.go @@ -276,7 +276,7 @@ func (s *statusDB) PutStatus(ctx context.Context, status *gtsmodel.Status) error // It is safe to run this database transaction within cache.Store // as the cache does not attempt a mutex lock until AFTER hook. // - return s.db.RunInTx(ctx, func(tx bun.Tx) error { + return s.db.RunInTx(ctx, func(tx Tx) error { // create links between this status and any emojis it uses for _, i := range status.EmojiIDs { if _, err := tx. @@ -342,7 +342,7 @@ func (s *statusDB) UpdateStatus(ctx context.Context, status *gtsmodel.Status, co // It is safe to run this database transaction within cache.Store // as the cache does not attempt a mutex lock until AFTER hook. // - return s.db.RunInTx(ctx, func(tx bun.Tx) error { + return s.db.RunInTx(ctx, func(tx Tx) error { // create links between this status and any emojis it uses for _, i := range status.EmojiIDs { if _, err := tx. @@ -420,7 +420,7 @@ func (s *statusDB) DeleteStatusByID(ctx context.Context, id string) error { // On return ensure status invalidated from cache. defer s.state.Caches.GTS.Status().Invalidate("ID", id) - return s.db.RunInTx(ctx, func(tx bun.Tx) error { + return s.db.RunInTx(ctx, func(tx Tx) error { // delete links between this status and any emojis it uses if _, err := tx. NewDelete(). -- cgit v1.2.3