(dataList *model.DataTableList)
| 6 | ) |
| 7 | |
| 8 | func PreCheck(dataList *model.DataTableList) { |
| 9 | |
| 10 | type ArrayFieldDefine struct { |
| 11 | FieldName string |
| 12 | ObjectName string |
| 13 | } |
| 14 | |
| 15 | fieldCountByField := map[ArrayFieldDefine]int{} |
| 16 | |
| 17 | // 合并前的数据表 |
| 18 | for _, tab := range dataList.AllTables() { |
| 19 | |
| 20 | // 遍历输入数据的每一列 |
| 21 | for _, header := range tab.Headers { |
| 22 | |
| 23 | // 输入的列头,为空表示改列被注释 |
| 24 | if header.TypeInfo == nil { |
| 25 | continue |
| 26 | } |
| 27 | |
| 28 | fieldKey := ArrayFieldDefine{ |
| 29 | FieldName: header.TypeInfo.FieldName, |
| 30 | ObjectName: header.TypeInfo.Name, |
| 31 | } |
| 32 | |
| 33 | if header.TypeInfo.IsArray() { |
| 34 | arrayFieldCount := tab.ArrayFieldCount(header) |
| 35 | if preFieldCount, ok := fieldCountByField[fieldKey]; ok { |
| 36 | |
| 37 | if preFieldCount != arrayFieldCount { |
| 38 | report.ReportError("ArrayMultiColumnDefineNotMatch") |
| 39 | } |
| 40 | } else { |
| 41 | fieldCountByField[fieldKey] = arrayFieldCount |
| 42 | } |
| 43 | } |
| 44 | |
| 45 | } |
| 46 | } |
| 47 | } |
| 48 | |
| 49 | // merge后检查 |
| 50 | func PostCheck(globals *model.Globals) { |
no test coverage detected