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

data file version support

上级 d7bb6d9a
title: 域名
desc: 从文件读取
author: wwccss
version: 1.0
field: domain
instances:
- instance: all
range: domain.txt:R
\ No newline at end of file
zentao.com
ngtesting.net
ngtesting.com
testfarm.net
\ No newline at end of file
INSERT INTO t_data(field1,field2) VALUES('int_1|2|3 ', '192.168.0.1,');
INSERT INTO t_data(field1,field2) VALUES('int_4|5|6 ', '192.168.1.2,');
INSERT INTO t_data(field1,field2) VALUES('int_7|8|9 ', '192.168.2.3,');
INSERT INTO t_data(field1,field2) VALUES('int_10|11|12 ', '192.168.3.4,');
INSERT INTO t_data(field1,field2) VALUES('int_13|14|15 ', '192.168.4.5,');
INSERT INTO t_data(field1,field2) VALUES('int_16|17|18 ', '192.168.5.6,');
INSERT INTO t_data(field1,field2) VALUES('int_19|20|21 ', '192.168.6.7,');
INSERT INTO t_data(field1,field2) VALUES('int_22|23|24 ', '192.168.7.8,');
INSERT INTO t_data(field1,field2) VALUES('int_25|26|27 ', '192.168.8.9,');
INSERT INTO t_data(field1,field2) VALUES('int_28|29|30 ', '192.168.9.10,');
INSERT INTO t_data(field1,field2) VALUES('int_31|32|33 ', '192.168.10.11,');
INSERT INTO t_data(field1,field2) VALUES('int_34|35|36 ', '192.168.11.12,');
INSERT INTO t_data(field1,field2) VALUES('int_37|38|39 ', '192.168.12.13,');
INSERT INTO t_data(field1,field2) VALUES('int_40|41|42 ', '192.168.13.14,');
INSERT INTO t_data(field1,field2) VALUES('int_43|44|45 ', '192.168.14.15,');
192.168.0.1,
192.168.1.2,
192.168.2.3,
192.168.3.4,
192.168.4.5,
192.168.5.6,
192.168.6.7,
192.168.7.8,
192.168.8.9,
192.168.9.10,
192.168.10.11,
192.168.11.12,
192.168.12.13,
192.168.13.14,
......@@ -11,12 +11,12 @@ fields:
- field: field2
note: 测试系统字段
from: system.ip.yaml
from: system.ip.v1.yaml
use: privateC,privateB
- field: field3
note: 测试Excel数据
from: system.address.city
from: system.address.v1.city
select: name
where: state like '%山东%'
......
......@@ -42,27 +42,19 @@
{
"id": "generate_records",
"translation": "Generate %d records, spend %d secs"
},
{
"id": "save_testdata",
"translation": "Test data saved to %s"
"translation": "Generate %d records to file %s, spend %d secs."
},
{
"id": "fail_to_connect_sqlite",
"translation": "fail to open SQLite %s, error: %s"
"translation": "fail to open SQLite %s, error: %s."
},
{
"id": "fail_to_exec_query",
"translation": "fail to exec query %s "
"translation": "fail to exec query %s."
},
{
"id": "fail_to_parse_row",
"translation": "fail to parse sqlite3 row %s"
},
{
"id": "fail_to_update_row",
"translation": "fail to insert/update row: "
"translation": "fail to parse sqlite3 row %s."
},
{
"id": "fail_to_save_excel",
......
......@@ -37,11 +37,7 @@
{
"id": "generate_records",
"translation": "生成%d个记录,耗时%d秒。"
},
{
"id": "save_testdata",
"translation": "成功保存生成的数据到%s。"
"translation": "生成%d个记录到文件%s,耗时%d秒。"
},
{
"id": "fail_to_connect_sqlite",
......
......@@ -30,7 +30,7 @@ func Generate(defFile string, total int, fieldsToExportStr string, out string, f
WriteToFile(out, content)
entTime := time.Now().Unix()
logUtils.Screen(i118Utils.I118Prt.Sprintf("generate_records", len(rows), entTime - startTime ))
logUtils.Screen(i118Utils.I118Prt.Sprintf("generate_records", len(rows), out, entTime - startTime ))
}
func Print(rows [][]string, format string, table string, colTypes []bool, fields []string) string {
......
......@@ -2,11 +2,8 @@ package action
import (
fileUtils "github.com/easysoft/zendata/src/utils/file"
i118Utils "github.com/easysoft/zendata/src/utils/i118"
logUtils "github.com/easysoft/zendata/src/utils/log"
)
func WriteToFile(path string, content string) {
fileUtils.WriteFile(path, content)
logUtils.Screen(i118Utils.I118Prt.Sprintf("save_testdata", path))
}
......@@ -46,13 +46,13 @@ func getResProp(from string) (string, string) {
sep := string(os.PathSeparator)
index := strings.LastIndex(from, ".yaml")
if index > -1 { // yaml, system.nubmer.yaml
if index > -1 { // yaml, system.ip.v1.yaml
left := from[:index]
left = strings.ReplaceAll(left, ".", sep)
resFile = left + ".yaml"
resType = "yaml"
} else { // excel, system.address.china
} else { // excel, system.address.v1.city
index = strings.LastIndex(from, ".")
left := from[:index]
......
此差异已折叠。
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册