diff options
author | 2023-08-17 17:26:21 +0100 | |
---|---|---|
committer | 2023-08-17 17:26:21 +0100 | |
commit | d5d6ad406f47ae738a7f6b1699b3b6e7ef916bb9 (patch) | |
tree | 44df2eaf48eca66023023569d4ba8d901d800226 /internal/db/bundb/mention.go | |
parent | [chore]: Bump github.com/jackc/pgx/v5 from 5.4.2 to 5.4.3 (#2112) (diff) | |
download | gotosocial-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/mention.go')
-rw-r--r-- | internal/db/bundb/mention.go | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/internal/db/bundb/mention.go b/internal/db/bundb/mention.go index 12d71a95a..547d8d0a8 100644 --- a/internal/db/bundb/mention.go +++ b/internal/db/bundb/mention.go @@ -31,7 +31,7 @@ import ( ) type mentionDB struct { - db *WrappedDB + db *DB state *state.State } @@ -45,7 +45,7 @@ func (m *mentionDB) GetMention(ctx context.Context, id string) (*gtsmodel.Mentio Where("? = ?", bun.Ident("mention.id"), id) if err := q.Scan(ctx); err != nil { - return nil, m.db.ProcessError(err) + return nil, err } return &mention, nil @@ -105,7 +105,7 @@ func (m *mentionDB) GetMentions(ctx context.Context, ids []string) ([]*gtsmodel. func (m *mentionDB) PutMention(ctx context.Context, mention *gtsmodel.Mention) error { return m.state.Caches.GTS.Mention().Store(mention, func() error { _, err := m.db.NewInsert().Model(mention).Exec(ctx) - return m.db.ProcessError(err) + return err }) } @@ -129,5 +129,5 @@ func (m *mentionDB) DeleteMentionByID(ctx context.Context, id string) error { Table("mentions"). Where("? = ?", bun.Ident("id"), id). Exec(ctx) - return m.db.ProcessError(err) + return err } |