提交 8437b8b6 编写于 作者: aaronchen2k2k's avatar aaronchen2k2k

fix 2 issues

上级 2e78907f
title: 测试文件
title: 冒烟测试文件
desc:
author: zentao
version: 1.0
fields:
- field: test1
range: [1-5]:3{2}
range: 1-5:3{2}
postfix: "\t"
- field: test2
......
......@@ -50,6 +50,7 @@ $>zd.exe -c demo/default.yaml -i test.txt --decode # Parse the file specified b
$>zd.exe -l # List all build-in data types.
$>zd.exe -v system.address.v1 # View data types in build-in Excel file system/address/v1.xlsx.
$>zd.exe -v system.address.v1.china # View data items in Excel sheet "china".
$>zd.exe -v system.ip.v1.yaml # View data items in build-in instances。
Service Example
......
此差异已折叠。
......@@ -42,6 +42,7 @@ $>zd.exe -c demo\default.yaml -i test.txt --decode 将-i指定的文件根据-d
$>zd.exe -l # 列出所有內置数据。
$>zd.exe -v system.address.v1 # 查看內置Excel文件system/address/v1.xlsx中的数据表。
$>zd.exe -v system.address.v1.china # 查看內置Excel文件china数据表中的数据。
$>zd.exe -v system.ip.v1.yaml # 查看內置名为IP的Instances数据。
服务模式举例:
......
......@@ -48,8 +48,14 @@ func LoadConfigDef(defaultFile, configFile string, fieldsToExport *[]string) mod
// use all fields from default
if len(*fieldsToExport) == 0 {
for _, field := range defaultDef.Fields {
*fieldsToExport = append(*fieldsToExport, field.Field)
if len(defaultDef.Fields) >0 {
for _, field := range defaultDef.Fields {
*fieldsToExport = append(*fieldsToExport, field.Field)
}
} else {
for _, field := range configDef.Fields {
*fieldsToExport = append(*fieldsToExport, field.Field)
}
}
}
......@@ -72,10 +78,10 @@ func mergerDefine(defaultDef, configDef *model.DefData) {
sortedKeys := make([]string, 0)
for i := range defaultDef.Fields {
CreatePathToFieldMap(&defaultDef.Fields[i], defaultFieldMap, &sortedKeys)
CreatePathToFieldMap(&defaultDef.Fields[i], defaultFieldMap, nil)
}
for i := range configDef.Fields {
CreatePathToFieldMap(&configDef.Fields[i], configFieldMap, nil)
CreatePathToFieldMap(&configDef.Fields[i], configFieldMap, &sortedKeys)
}
// overwrite
......
......@@ -58,6 +58,9 @@ func GetRandFromRange(dataType, start, end, step, repeatStr, precisionStr string
endChar := end[0]
stepInt, _ := strconv.ParseInt(step, 10, 64)
countInRound := int64(int64(endChar) - int64(startChar)) / stepInt
if countInRound <0 {
countInRound = countInRound * -1
}
for i := 0; i < count; i++ {
rand := commonUtils.RandNum64(countInRound)
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册