MCPcopy
hub / github.com/davyxu/tabtoy / checkRepeat

Function checkRepeat

v3/checker/checker_repeat.go:8–50  ·  view source on GitHub ↗
(globals *model.Globals)

Source from the content-addressed store, hash-verified

6)
7
8func 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}

Callers 1

PostCheckFunction · 0.85

Calls 4

ReportErrorFunction · 0.92
AllTablesMethod · 0.80
GetCellMethod · 0.80
StringMethod · 0.45

Tested by

no test coverage detected