fix: Bug where renaming the main folder did not update db path

settings where the ones of the previous folder.
This commit is contained in:
2026-06-18 11:20:20 +02:00
parent 59f1775fcd
commit b6d991b799
6 changed files with 93 additions and 33 deletions
+19
View File
@@ -651,6 +651,25 @@ func (r *Repo) DeleteAll(ctx context.Context) (int64, error) {
return n, nil
}
// DeleteMany removes several QSOs in one statement. Returns the number deleted.
func (r *Repo) DeleteMany(ctx context.Context, ids []int64) (int64, error) {
if len(ids) == 0 {
return 0, nil
}
ph := make([]string, len(ids))
args := make([]any, len(ids))
for i, id := range ids {
ph[i] = "?"
args[i] = id
}
res, err := r.db.ExecContext(ctx, `DELETE FROM qso WHERE id IN (`+strings.Join(ph, ",")+`)`, args...)
if err != nil {
return 0, fmt.Errorf("delete qsos: %w", err)
}
n, _ := res.RowsAffected()
return n, nil
}
// Delete removes a QSO by id.
func (r *Repo) Delete(ctx context.Context, id int64) error {
res, err := r.db.ExecContext(ctx, `DELETE FROM qso WHERE id = ?`, id)