ImportQaApis imports csv file to the table `qa_apis`
(qaProjectId string, file io.ReadCloser, incremental bool)
| 440 | |
| 441 | // ImportQaApis imports csv file to the table `qa_apis` |
| 442 | func (s *Service) ImportQaApis(qaProjectId string, file io.ReadCloser, incremental bool) errors.Error { |
| 443 | if !incremental { |
| 444 | // delete old data associated with this qaProjectId |
| 445 | err := s.dal.Delete(&qa.QaApi{}, dal.Where("qa_project_id = ?", qaProjectId)) |
| 446 | if err != nil { |
| 447 | return errors.Default.Wrap(err, fmt.Sprintf("failed to delete old qa_apis for qaProjectId %s", qaProjectId)) |
| 448 | } |
| 449 | } |
| 450 | return s.importCSV(file, qaProjectId, s.qaApiHandler(qaProjectId)) |
| 451 | } |
| 452 | |
| 453 | // qaApiHandler saves a record into the `qa_apis` table |
| 454 | func (s *Service) qaApiHandler(qaProjectId string) func(record map[string]interface{}) errors.Error { |