func (s *mockStore) DeleteBackup(backup *model.Backup) (deleted bool, err error) { if _, ok := s.backups[backup.ID]; ok { delete(s.backups, backup.ID) deleted = true } backup.ID = 0 return deleted, nil }
func (s *mockStore) SaveBackup(backup *model.Backup) (created bool, err error) { if _, ok := s.jobs[backup.JobID]; !ok { return false, errors.New("Job not found") } if backup.ID == 0 { s.idCounter++ backup.ID = s.idCounter created = true } s.backups[backup.ID] = *backup return created, nil }