gangly / datafaker

Datafaker is a large-scale test data and flow test data generation tool. Datafaker fakes data and inserts to varied data sources. 测试数据生成工具
625 stars 168 forks source link

以嵌套Json格式往kafka写数据,每条消息都多一行空格 #65

Open moody1117 opened 3 years ago

moody1117 commented 3 years ago

json.txt: {"name":"[:name]","age":[:age],"school":{"sch_name":"[:enum(file://names.txt)]","sch_address":"[:address]","scores":[{"class":"[:enum(Math,English)]","score":[:decimal(4,2,1)]}]}}

启动命令: datafaker kafka node06.jstdata.com:9092 caolvtest 100 --metaj json.txt --interval 0.5 --outprint

结果: image

{"name":"杨东","age":84,"school":{"sch_name":"旧大院","sch_address":"重庆市武汉县浔阳沈阳街g座 894541","scores":[{"class":"Math","score":36.84}]}}

insert 1 records {"name":"刘凤兰","age":92,"school":{"sch_name":"广东中学","sch_address":"四川省秀梅市永川柳州路D座 283004","scores":[{"class":"Math","score":85.53}]}}

insert 2 records {"name":"李涛","age":99,"school":{"sch_name":"人和中心","sch_address":"江西省潮州县涪城吴路T座 323229","scores":[{"class":"Math","score":6.78}]}}

insert 3 records {"name":"王秀梅","age":15,"school":{"sch_name":"旧大院","sch_address":"澳门特别行政区浩县淄川秦路S座 701829","scores":[{"class":"English","score":81.15}]}}

insert 4 records {"name":"王芳","age":90,"school":{"sch_name":"旧大院","sch_address":"浙江省萍市清浦贵阳路K座 465548","scores":[{"class":"English","score":94.8}]}}

moody1117 commented 3 years ago

问题已解决,给您提交了pull request