summaryrefslogtreecommitdiff
path: root/internal/db/bundb/account.go
diff options
context:
space:
mode:
authorLibravatar kim <89579420+NyaaaWhatsUpDoc@users.noreply.github.com>2023-08-31 10:46:15 +0100
committerLibravatar GitHub <noreply@github.com>2023-08-31 11:46:15 +0200
commit1ee99fc16583e4cefc46011dbc63ca8ed91d3189 (patch)
tree950b661bb7c7b4cdb5057ee824ba75ae15fd3adc /internal/db/bundb/account.go
parent[chore]: Bump github.com/google/uuid from 1.3.0 to 1.3.1 (#2166) (diff)
downloadgotosocial-1ee99fc16583e4cefc46011dbc63ca8ed91d3189.tar.xz
[bugfix] wrap bun.Tx to add our own error processing (#2169)
* wrap bun.Tx to add our own error processing Signed-off-by: kim <grufwub@gmail.com> * add compile-time check for updateRowError() compatibility with sql.Row, fix wrapTx() not being used properly Signed-off-by: kim <grufwub@gmail.com> --------- Signed-off-by: kim <grufwub@gmail.com>
Diffstat (limited to 'internal/db/bundb/account.go')
-rw-r--r--internal/db/bundb/account.go6
1 files changed, 3 insertions, 3 deletions
diff --git a/internal/db/bundb/account.go b/internal/db/bundb/account.go
index c88edebbf..43e5055e1 100644
--- a/internal/db/bundb/account.go
+++ b/internal/db/bundb/account.go
@@ -298,7 +298,7 @@ func (a *accountDB) PutAccount(ctx context.Context, account *gtsmodel.Account) e
// It is safe to run this database transaction within cache.Store
// as the cache does not attempt a mutex lock until AFTER hook.
//
- return a.db.RunInTx(ctx, func(tx bun.Tx) error {
+ return a.db.RunInTx(ctx, func(tx Tx) error {
// create links between this account and any emojis it uses
for _, i := range account.EmojiIDs {
if _, err := tx.NewInsert().Model(&gtsmodel.AccountToEmoji{
@@ -327,7 +327,7 @@ func (a *accountDB) UpdateAccount(ctx context.Context, account *gtsmodel.Account
// It is safe to run this database transaction within cache.Store
// as the cache does not attempt a mutex lock until AFTER hook.
//
- return a.db.RunInTx(ctx, func(tx bun.Tx) error {
+ return a.db.RunInTx(ctx, func(tx Tx) error {
// create links between this account and any emojis it uses
// first clear out any old emoji links
if _, err := tx.
@@ -375,7 +375,7 @@ func (a *accountDB) DeleteAccount(ctx context.Context, id string) error {
return err
}
- return a.db.RunInTx(ctx, func(tx bun.Tx) error {
+ return a.db.RunInTx(ctx, func(tx Tx) error {
// clear out any emoji links
if _, err := tx.
NewDelete().