easysoft / zendata Goto Github PK
View Code? Open in Web Editor NEWLicense: GNU General Public License v3.0
License: GNU General Public License v3.0
例如:覆盖文件前缀定义为:prefix: "",被覆盖文件前缀定义为:prefix: "asd",生成数据时前缀是asd。
start compile linux
CGO_ENABLED=1 GOOS=linux GOARCH=amd64 CC=/usr/local/gcc-4.8.1-for-linux64/bin/x86_64-pc-linux-gcc CXX=/usr/local/gcc-4.8.1-for-linux64/bin/x86_64-pc-linux-g++ go build -o bin/zd/2.1/linux/zd/zd src/zd.go
src/zd.go:6:2: no required module provides package github.com/easysoft/zendata/res; to add it:
go get github.com/easysoft/zendata/res
make: *** [Makefile:45: compile_linux] Error 1
import (
"flag"
"fmt"
"github.com/easysoft/zendata/res"
"github.com/easysoft/zendata/src/action"
"github.com/easysoft/zendata/src/gen"
"github.com/easysoft/zendata/src/server"
serverConfig "github.com/easysoft/zendata/src/server/config"
serverUtils "github.com/easysoft/zendata/src/server/utils"
serverConst "github.com/easysoft/zendata/src/server/utils/const"
"github.com/easysoft/zendata/src/service"
commonUtils "github.com/easysoft/zendata/src/utils/common"
configUtils "github.com/easysoft/zendata/src/utils/config"
constant "github.com/easysoft/zendata/src/utils/const"
fileUtils "github.com/easysoft/zendata/src/utils/file"
i118Utils "github.com/easysoft/zendata/src/utils/i118"
logUtils "github.com/easysoft/zendata/src/utils/log"
stringUtils "github.com/easysoft/zendata/src/utils/string"
"github.com/easysoft/zendata/src/utils/vari"
assetfs "github.com/elazarl/go-bindata-assetfs"
"github.com/fatih/color"
"io/ioutil"
"net/http"
"os"
"os/signal"
"path/filepath"
"strconv"
"strings"
"syscall"
"time"
)
/log/
/.idea/
/build/
/tmp/cache/.data.db-shm
/tmp/cache/.data.db-wal
/demo/out/
/conf/
/bin/
/test/ztf/output/
/test/ztf/.idea/
/nohup.out
/test/ztf/conf/
/test/ztf/log/
/demo/out/
/test/ztf/._config.yaml
/test/ztf/._default.yaml
/._config.yaml
/._default.yaml
/res/res.go
/tmp/.temp.yaml
/tmp/.default.yaml
/tmp/.config.yaml
/qshell.log
/log-zd/
/data/test/
/test/out/
/yaml/article/chinese/slang/out/
/runtime/protobuf/go
/runtime/protobuf/out/
/users/common/
第一次使用内置数据时,提示:请点击“刷新数据”按钮。
类似这样的数据格式要怎么生成呢,尝试使用你们官网的链接,但不起作用,做不到嵌套的效果
{
a:{
c:2,
d:3
},
b:1
}
测试图产品时,需要关系数据,是否支持关系数据生成?
目前只能支持yaml格式文件吗?能否支持proto文件,基于proto定义的rpc服务生成对应的response数据?
数据格式配置文件
title: test_random_float
fields:
- field: float
range: 1.0001-1.9999
postfix: "\t"
- field: float_r
range: 1.0001-1.9999:R
生成的数据
1.0 1.0
1.0 1.0
1.0 1.0
1.0 1.0
1.0 1.0
1.0 1.0
1.0 1.0
1.0 1.0
1.0 1.0
1.0 1.0
Zendata tool localization tool is very good, currently intended to be used for platforming.
But zendata http protocol only supports the generation of json data, localization of csv, sql, xml format can not be generated.
Super useful mysql data direct generation function can not be used in http.
Currently the zendata command line tool is exposed as an http interface
through shell2http tool.
I hope that the subsequent support for http interface multi-format data generation.
version: 2.2
zd.exe -p 8848
客户端调用:
$curl http://localhost:8848/?d=demo/default.yaml&c=demo/config.yaml&n=100&T=true # 通过GET方式指定服务器端配置文件。
$curl http://localhost:8848/?default=demo/default.yaml&output=test.sql&table=user # 参数名可以用全拼。
$curl -i -X POST http://localhost:8848?lines=3 -F default=@demo/default.yaml # 可以通过POST方式上传配置文件。
It doesn't work.
实例文件
title: user
desc: 创建一些默认用户
author: ly
version: 1.0
instances:
- instance: user
note: 默认用户列表
fields:
- field: user
range: admin,dev1,dev2,dev3,test1,test2,test3
- instance: userB
note: 逗号拼接用户
fields:
- field: user1
range: admin
postfix: ","
- field: user2
range: dev1
postfix: ","
- field: user3
range: dev2
生成数据文件:
title: table zt_story
desc: "需求"
author: automated export
version: "1.0"
fields:
- field: id
note: "ID"
range: 1-10000
prefix: ""
postfix: ""
loop: 0
format: ""
- field: date
note: "日期"
from: common.user.v1.yaml
use: userB
prefix: ""
postfix: ""
loop: 0
format: ""
调用命令:
❯ zd -c aaaaa.yaml -n 100 -o out.sql -table aaa
❯ zd -c aaaaa.yaml -n 1000 -o out.sql -table aaa
❯ zd -c aaaaa.yaml -n 10000 -o out.sql -table aaa
❯ zd -c aaaaa.yaml -n 10001 -o out.sql -table aaa
为Field 生成数据失败。
为Field 生成数据失败。
超过10001条数据的时候,报错了
/Users/aaron/rd/project/zentao/go/zd/internal/pkg/service/excel.go:415 no such table: excel_update
[0.000ms] [rows:-] SELECT id, name, changeTime FROM excel_update WHERE name = 'D:\Programming\OpenSourceTools\zd\data\city\v1.xlsx' ORDER BY changeTime DESC LIMIT 1;
SQLite查询失败,语句:SELECT id, name, changeTime FROM excel_update WHERE name = 'D:\Programming\OpenSourceTools\zd\data\city\v1.xlsx' ORDER BY changeTime DESC LIMIT 1;,错误:no such table: excel_update。
Create sql 里面如果有索引。 则转换出来的 yaml 模板 ,会将index 作为 字段 生成到 yaml 里面
如果创建的table a sql 命令'a' 和() 中间有多个空格,那么创建的yaml 文件为 a .yaml ,正常应该是 a.yaml
在我的数据,区间列表页面,修改取值文本框内后,没有自动保存。
经测试对sqlserver的数据库连接,以及-i导入,无法正常使用
测试了一下生成10条数据花了60秒,是我的写法有问题吗?这效率已经超出我的想象范围了。
yaml文件如下:
title: 用户数据生成
fields:
- field: name
from: name.cn.given.v1
where: "double='true'"
select: name
看了一下人名的excel里有几万条数据。
Is it possible to support data generation by configuring the format in yaml and then generate it directly through web interface calls?
It is possible to output data in other formats at the command line, but I have to maintain my command line scripts. Why not integrate it into a web page to manage it?
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.