提交 5524be68 编写于 作者: aaronchen2k2k's avatar aaronchen2k2k

fix decode issue

上级 8d7b7bed
......@@ -8,17 +8,41 @@ fields:
range: 1-3{3}
loop: 2-3
loopfix: "|"
postfix: "\t"
width: 10
prefix: "["
postfix: "]\t"
# width: 10
- field: test1
range: 9-5:R{2}
postfix: "\t"
width: 5
prefix: "["
postfix: "]\t"
# width: 5
- field: test2
range: [user-2,user3,user4,user5,user6]:R
loop: 2-3
loopfix: "|"
postfix: "\t"
width: 25
\ No newline at end of file
prefix: "["
postfix: "]\t"
# width: 25
- field: field_with_children
fields:
- field: child1
range: a-z
prefix: part1_
postfix: '|'
- field: child2
range: A-Z
prefix: part2_
postfix: '|'
- field: child_with_child
prefix: part3_
postfix:
fields:
- field: field_grandson
prefix: int_
range: 10-20
postfix:
\ No newline at end of file
......@@ -47,7 +47,7 @@ func Generate(defaultFile string, configFile string, total int, fieldsToExportSt
Print(rows, format, table, colIsNumArr, fieldsToExport)
entTime := time.Now().Unix()
if vari.RunMode == constant.RunModeServerRequest {
if vari.RunMode == constant.RunModeServerRequest || out != "" {
logUtils.PrintToWithColor(i118Utils.I118Prt.Sprintf("server_response", len(rows), entTime - startTime), color.FgCyan)
}
}
......
......@@ -79,7 +79,7 @@ func decodeOneLevel(line string, fields []model.DefField, rowMap *map[string]int
index := searchRune(left, sep)
if index > -1 {
col = string(left[: index+runewidth.StringWidth(field.Postfix)])
left = left[index+runewidth.StringWidth(field.Postfix) :]
left = left[index+runewidth.StringWidth(field.Prefix)+1:]
}
} else if j == len(fields) - 1 {
col = string(left)
......@@ -91,11 +91,11 @@ func decodeOneLevel(line string, fields []model.DefField, rowMap *map[string]int
children := field.Fields
if len(children) > 0 {
colWithoutFix := col[runewidth.StringWidth(field.Postfix):
runewidth.StringWidth(col) - runewidth.StringWidth(field.Postfix)]
//colWithoutFix := col[runewidth.StringWidth(field.Postfix):
// runewidth.StringWidth(col) - runewidth.StringWidth(field.Postfix)]
rowMapChild := map[string]interface{}{}
decodeOneLevel(colWithoutFix, children, &rowMapChild)
decodeOneLevel(col, children, &rowMapChild)
(*rowMap)[field.Field + ".fields"] = rowMapChild
}
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册