summaryrefslogtreecommitdiff
path: root/internal/db/bundb/marker.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/marker.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/marker.go')
-rw-r--r--internal/db/bundb/marker.go10
1 files changed, 5 insertions, 5 deletions
diff --git a/internal/db/bundb/marker.go b/internal/db/bundb/marker.go
index 12526e659..861f7de36 100644
--- a/internal/db/bundb/marker.go
+++ b/internal/db/bundb/marker.go
@@ -30,7 +30,7 @@ import (
)
type markerDB struct {
- db *WrappedDB
+ db *DB
state *state.State
}
@@ -48,7 +48,7 @@ func (m *markerDB) GetMarker(ctx context.Context, accountID string, name gtsmode
Model(&marker).
Where("? = ? AND ? = ?", bun.Ident("account_id"), accountID, bun.Ident("name"), name).
Scan(ctx); err != nil {
- return nil, m.db.ProcessError(err)
+ return nil, err
}
return &marker, nil
@@ -79,7 +79,7 @@ func (m *markerDB) UpdateMarker(ctx context.Context, marker *gtsmodel.Marker) er
if _, err := m.db.NewInsert().
Model(marker).
Exec(ctx); err != nil {
- return m.db.ProcessError(err)
+ return err
}
return nil
}
@@ -94,12 +94,12 @@ func (m *markerDB) UpdateMarker(ctx context.Context, marker *gtsmodel.Marker) er
Where("? = ?", bun.Ident("version"), prevMarker.Version).
Exec(ctx)
if err != nil {
- return m.db.ProcessError(err)
+ return err
}
rowsAffected, err := result.RowsAffected()
if err != nil {
- return m.db.ProcessError(err)
+ return err
}
if rowsAffected == 0 {
// Will trigger a rollback, although there should be no changes to roll back.