(globals *model.Globals)
| 6 | ) |
| 7 | |
| 8 | func checkRepeat(globals *model.Globals) { |
| 9 | |
| 10 | for _, tab := range globals.Datas.AllTables() { |
| 11 | |
| 12 | // 遍历输入数据的每一列 |
| 13 | for _, header := range tab.Headers { |
| 14 | |
| 15 | // 输入的列头,为空表示改列被注释 |
| 16 | if header.TypeInfo == nil { |
| 17 | continue |
| 18 | } |
| 19 | |
| 20 | // 这列需要建立索引 |
| 21 | if header.TypeInfo.MakeIndex { |
| 22 | |
| 23 | checker := map[string]*model.Cell{} |
| 24 | |
| 25 | for row := 1; row < len(tab.Rows); row++ { |
| 26 | |
| 27 | inputCell := tab.GetCell(row, header.Cell.Col) |
| 28 | |
| 29 | // 这行被注释,无效行 |
| 30 | if inputCell == nil { |
| 31 | continue |
| 32 | } |
| 33 | |
| 34 | if inputCell.Value == "" { |
| 35 | continue |
| 36 | } |
| 37 | |
| 38 | if _, ok := checker[inputCell.Value]; ok { |
| 39 | |
| 40 | report.ReportError("DuplicateValueInMakingIndex", inputCell.String()) |
| 41 | |
| 42 | } else { |
| 43 | checker[inputCell.Value] = inputCell |
| 44 | } |
| 45 | |
| 46 | } |
| 47 | } |
| 48 | } |
| 49 | } |
| 50 | } |
no test coverage detected