命令行调用示例
- 2020-08-13 08:37:38
- 陈琦
- 2941
- 最后编辑:陈琦 于 2020-08-13 10:42:07
- 分享链接
以下是ZenData命令的一些示例:
数据生成
$>zd.exe -d demo\default.yaml # 根据-d参数指定的配置文件生成10条记录。 $>zd.exe -c demo\default.yaml # 根据-c参数指定的配置文件生成10条记录。 $>zd.exe -c demo\default.yaml -r # 根据-c参数指定的配置文件,采用递归的方式生成10条记录。 $>zd.exe -d demo\default.yaml -c demo\test.yaml -n 100 # -c和-d两个文件的配置合并,输出100条记录。 $>zd.exe -d demo\default.yaml -c demo\test.yaml -n 100 -o test.txt # 输出原始格式的数据。 $>zd.exe -d demo\default.yaml -c demo\test.yaml -n 100 -o test.json # 输出json格式的数据。 $>zd.exe -d demo\default.yaml -c demo\test.yaml -n 100 -o test.xml # 输出xml格式的数据。 $>zd.exe -d demo\default.yaml -n 100 -o test.sql -t user # 输出插入到user表里面的sql。 $>zd.exe -d demo\default.yaml -n 100 -o test.sql -t user --trim # 输出插入到user表里面的sql,去掉前缀和后缀。
內置数据查看
$>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数据。
从SQL生成数据定义
$>zd.exe -i demo\zentao.sql -o db # 根据sql的定义生成每个表的yaml文件,存储到db目录里面。
数据反向解析
$>zd.exe -c demo\default.yaml -i test.txt --decode # 将-i指定的文件根据-d参数的配置进行解析。
HTTP服务
启动服务: $zd.exe -p 80 # 监听80端口,以zd.exe文件所在目录为根目录。 $zd.exe -p 80 -R d:\zd\config # 监听80端口,以d:\zd\config为根目录。 客户端调用: $curl http://loclahost/?d=default.yaml&c=config.yaml&n=100&o=test.sql&t=user # 通过GET方式指定服务器端配置文件。 $curl http://loclahost/?default=default.yaml&output=test.sql&table=user # 参数名可以用全拼。 $curl -d "default=...&config=...&lines=10" http://localhost/ # 可以通过POST方式上传配置。
发表评论