mirror of
1
Fork 0

[chore] fix merge issue (#2029)

This commit is contained in:
tobi 2023-07-27 12:54:27 +02:00 committed by GitHub
parent 98c2b8ff7e
commit e747c14685
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 4 additions and 4 deletions

View File

@ -32,7 +32,7 @@ func (r *relationshipDB) GetNote(ctx context.Context, sourceAccountID string, ta
ctx, ctx,
"AccountID.TargetAccountID", "AccountID.TargetAccountID",
func(note *gtsmodel.AccountNote) error { func(note *gtsmodel.AccountNote) error {
return r.conn.NewSelect().Model(note). return r.db.NewSelect().Model(note).
Where("? = ?", bun.Ident("account_id"), sourceAccountID). Where("? = ?", bun.Ident("account_id"), sourceAccountID).
Where("? = ?", bun.Ident("target_account_id"), targetAccountID). Where("? = ?", bun.Ident("target_account_id"), targetAccountID).
Scan(ctx) Scan(ctx)
@ -49,7 +49,7 @@ func (r *relationshipDB) getNote(ctx context.Context, lookup string, dbQuery fun
// Not cached! Perform database query // Not cached! Perform database query
if err := dbQuery(&note); err != nil { if err := dbQuery(&note); err != nil {
return nil, r.conn.ProcessError(err) return nil, r.db.ProcessError(err)
} }
return &note, nil return &note, nil
@ -88,12 +88,12 @@ func (r *relationshipDB) getNote(ctx context.Context, lookup string, dbQuery fun
func (r *relationshipDB) PutNote(ctx context.Context, note *gtsmodel.AccountNote) error { func (r *relationshipDB) PutNote(ctx context.Context, note *gtsmodel.AccountNote) error {
note.UpdatedAt = time.Now() note.UpdatedAt = time.Now()
return r.state.Caches.GTS.AccountNote().Store(note, func() error { return r.state.Caches.GTS.AccountNote().Store(note, func() error {
_, err := r.conn. _, err := r.db.
NewInsert(). NewInsert().
Model(note). Model(note).
On("CONFLICT (?, ?) DO UPDATE", bun.Ident("account_id"), bun.Ident("target_account_id")). On("CONFLICT (?, ?) DO UPDATE", bun.Ident("account_id"), bun.Ident("target_account_id")).
Set("? = ?, ? = ?", bun.Ident("updated_at"), note.UpdatedAt, bun.Ident("comment"), note.Comment). Set("? = ?, ? = ?", bun.Ident("updated_at"), note.UpdatedAt, bun.Ident("comment"), note.Comment).
Exec(ctx) Exec(ctx)
return r.conn.ProcessError(err) return r.db.ProcessError(err)
}) })
} }