many fixes

This commit is contained in:
2026-07-03 11:18:40 +07:00
parent d909618ced
commit 79fd200e57
12 changed files with 348 additions and 18 deletions
+9
View File
@@ -79,6 +79,15 @@ func (s *Store) SetAccountStatus(ctx context.Context, id int64, status string) e
return err
}
// ResetAccountCounters zeroes the per-account copied/skipped/error counts at the
// start of a run so a re-run reflects only the current run's totals instead of
// accumulating on top of the previous run (IncAccountCounters is additive).
func (s *Store) ResetAccountCounters(ctx context.Context, id int64) error {
_, err := s.Pool.Exec(ctx,
`UPDATE accounts SET copied_count=0, skipped_count=0, error_count=0 WHERE id=$1`, id)
return err
}
func (s *Store) IncAccountCounters(ctx context.Context, id, copied, skipped, errs int64) error {
_, err := s.Pool.Exec(ctx,
`UPDATE accounts SET copied_count=copied_count+$2,