summaryrefslogtreecommitdiff
path: root/internal/db/bundb/relationship_block.go
diff options
context:
space:
mode:
authorLibravatar kim <89579420+NyaaaWhatsUpDoc@users.noreply.github.com>2023-08-17 17:26:21 +0100
committerLibravatar GitHub <noreply@github.com>2023-08-17 17:26:21 +0100
commitd5d6ad406f47ae738a7f6b1699b3b6e7ef916bb9 (patch)
tree44df2eaf48eca66023023569d4ba8d901d800226 /internal/db/bundb/relationship_block.go
parent[chore]: Bump github.com/jackc/pgx/v5 from 5.4.2 to 5.4.3 (#2112) (diff)
downloadgotosocial-d5d6ad406f47ae738a7f6b1699b3b6e7ef916bb9.tar.xz
[bugfix] fix double firing bun.DB query hooks (#2124)
* improve bun.DB wrapping readability + comments, fix double-firing query hooks * fix incorrect code comment placement * fix linter issues * Update internal/db/basic.go * do as the linter commmands ... --------- Signed-off-by: kim <grufwub@gmail.com> Co-authored-by: Daenney <daenney@users.noreply.github.com>
Diffstat (limited to 'internal/db/bundb/relationship_block.go')
-rw-r--r--internal/db/bundb/relationship_block.go12
1 files changed, 6 insertions, 6 deletions
diff --git a/internal/db/bundb/relationship_block.go b/internal/db/bundb/relationship_block.go
index 33a3b85fa..efaa6d1a9 100644
--- a/internal/db/bundb/relationship_block.go
+++ b/internal/db/bundb/relationship_block.go
@@ -124,7 +124,7 @@ func (r *relationshipDB) getBlock(ctx context.Context, lookup string, dbQuery fu
// Not cached! Perform database query
if err := dbQuery(&block); err != nil {
- return nil, r.db.ProcessError(err)
+ return nil, err
}
return &block, nil
@@ -180,7 +180,7 @@ func (r *relationshipDB) PopulateBlock(ctx context.Context, block *gtsmodel.Bloc
func (r *relationshipDB) PutBlock(ctx context.Context, block *gtsmodel.Block) error {
return r.state.Caches.GTS.Block().Store(block, func() error {
_, err := r.db.NewInsert().Model(block).Exec(ctx)
- return r.db.ProcessError(err)
+ return err
})
}
@@ -205,7 +205,7 @@ func (r *relationshipDB) DeleteBlockByID(ctx context.Context, id string) error {
Table("blocks").
Where("? = ?", bun.Ident("id"), id).
Exec(ctx)
- return r.db.ProcessError(err)
+ return err
}
func (r *relationshipDB) DeleteBlockByURI(ctx context.Context, uri string) error {
@@ -229,7 +229,7 @@ func (r *relationshipDB) DeleteBlockByURI(ctx context.Context, uri string) error
Table("blocks").
Where("? = ?", bun.Ident("uri"), uri).
Exec(ctx)
- return r.db.ProcessError(err)
+ return err
}
func (r *relationshipDB) DeleteAccountBlocks(ctx context.Context, accountID string) error {
@@ -246,7 +246,7 @@ func (r *relationshipDB) DeleteAccountBlocks(ctx context.Context, accountID stri
accountID,
).
Scan(ctx, &blockIDs); err != nil {
- return r.db.ProcessError(err)
+ return err
}
defer func() {
@@ -270,5 +270,5 @@ func (r *relationshipDB) DeleteAccountBlocks(ctx context.Context, accountID stri
Table("blocks").
Where("? IN (?)", bun.Ident("id"), bun.In(blockIDs)).
Exec(ctx)
- return r.db.ProcessError(err)
+ return err
}