MCPcopy Index your code
hub / github.com/apache/devlake / ImportQaApis

Method ImportQaApis

backend/plugins/customize/service/service.go:442–451  ·  view source on GitHub ↗

ImportQaApis imports csv file to the table `qa_apis`

(qaProjectId string, file io.ReadCloser, incremental bool)

Source from the content-addressed store, hash-verified

440
441// ImportQaApis imports csv file to the table `qa_apis`
442func (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
454func (s *Service) qaApiHandler(qaProjectId string) func(record map[string]interface{}) errors.Error {

Callers 2

TestImportQaApisDataFlowFunction · 0.95

Calls 4

importCSVMethod · 0.95
qaApiHandlerMethod · 0.95
WrapMethod · 0.80
DeleteMethod · 0.65

Tested by 2

TestImportQaApisDataFlowFunction · 0.76