ZData使用示例
命令行模式举例:
$>zd.exe -d demo\default.yaml 根据-d参数指定的配置文件生成10条记录。 $>zd.exe -c demo\default.yaml 根据-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 -s mysql 输出插入到user表里面的sql。 $>zd.exe -i db.sql -s mysql -o db 根据db.sql的定义生成每个表的yaml文件,存储到db目录里面。 $>zd.exe -c demo\default.yaml -i test.txt --decode 将-i指定的文件根据-d参数的配置进行解析。服务模式举例:
$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.yamloutput=test.sql&table=user 参数名可以用全拼。 $curl -d "default=...&config=...&lines=10" http://localhost/ 可以通过POST方式上传配置。