mirror of
https://github.com/superseriousbusiness/gotosocial.git
synced 2025-11-21 23:57:30 -06:00
[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>
This commit is contained in:
parent
2ec313a21f
commit
1ee99fc165
7 changed files with 271 additions and 47 deletions
|
|
@ -206,7 +206,7 @@ func (l *listDB) DeleteListByID(ctx context.Context, id string) error {
|
|||
}
|
||||
}()
|
||||
|
||||
return l.db.RunInTx(ctx, func(tx bun.Tx) error {
|
||||
return l.db.RunInTx(ctx, func(tx Tx) error {
|
||||
// Delete all entries attached to list.
|
||||
if _, err := tx.NewDelete().
|
||||
Table("list_entries").
|
||||
|
|
@ -423,7 +423,7 @@ func (l *listDB) PutListEntries(ctx context.Context, entries []*gtsmodel.ListEnt
|
|||
}()
|
||||
|
||||
// Finally, insert each list entry into the database.
|
||||
return l.db.RunInTx(ctx, func(tx bun.Tx) error {
|
||||
return l.db.RunInTx(ctx, func(tx Tx) error {
|
||||
for _, entry := range entries {
|
||||
entry := entry // rescope
|
||||
if err := l.state.Caches.GTS.ListEntry().Store(entry, func() error {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue