chore: update store error check

This commit is contained in:
Steven
2023-06-21 08:40:49 +08:00
parent 895cd8e38c
commit 01ed504735
2 changed files with 8 additions and 16 deletions

View File

@ -174,10 +174,6 @@ func (s *Store) ListShortcuts(ctx context.Context, find *FindShortcut) ([]*Short
return nil, err
}
if err := tx.Commit(); err != nil {
return nil, err
}
return shortcuts, nil
}
@ -193,10 +189,6 @@ func (s *Store) GetShortcut(ctx context.Context, find *FindShortcut) (*Shortcut,
return nil, err
}
if err := tx.Commit(); err != nil {
return nil, err
}
if len(shortcuts) == 0 {
return nil, nil
}
@ -210,9 +202,7 @@ func (s *Store) DeleteShortcut(ctx context.Context, delete *DeleteShortcut) erro
}
defer tx.Rollback()
if _, err := tx.ExecContext(ctx, `
DELETE FROM shortcut WHERE id = ?
`, delete.ID); err != nil {
if _, err := tx.ExecContext(ctx, `DELETE FROM shortcut WHERE id = ?`, delete.ID); err != nil {
return err
}