Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
易企天创
zendata
提交
8c45d0b1
Z
zendata
项目概览
易企天创
/
zendata
9 个月 前同步成功
通知
17
Star
2
Fork
1
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
1
列表
看板
标记
里程碑
合并请求
0
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
Z
zendata
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
1
Issue
1
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
前往新版Gitcode,体验更适合开发者的 AI 搜索 >>
提交
8c45d0b1
编写于
5月 25, 2020
作者:
aaronchen2k2k
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
update help
上级
53de14a0
变更
7
展开全部
隐藏空白更改
内联
并排
Showing
7 changed file
with
34 addition
and
25 deletion
+34
-25
demo/test.yaml
demo/test.yaml
+0
-3
res/doc/sample.txt
res/doc/sample.txt
+4
-4
res/doc/usage.txt
res/doc/usage.txt
+9
-9
res/res.go
res/res.go
+3
-3
src/action/generator.go
src/action/generator.go
+3
-1
src/action/sql.go
src/action/sql.go
+9
-3
src/zd.go
src/zd.go
+6
-2
未找到文件。
demo/test.yaml
浏览文件 @
8c45d0b1
...
...
@@ -5,12 +5,10 @@ version: 1.0
fields
:
-
field
:
field0
note
:
range
:
a-z
loop
:
3
-
field
:
field1
note
:
测试自定义字段
from
:
numb.yaml
use
:
small,large
loop
:
3
...
...
@@ -22,7 +20,6 @@ fields:
loop
:
3
-
field
:
field3
note
:
测试Excel数据
from
:
system.address.v1.city
select
:
name
where
:
state like '%山东%'
\ No newline at end of file
res/doc/sample.txt
浏览文件 @
8c45d0b1
$>zd.exe -s 根据系统提示,设置工具语言属性。
$>zd.exe -y sample/test.yaml -c 15 -field field1 -o sample/output.txt -f text
执行数据生成命令。使用配置文件sample/test.yaml,生成15行数据,以text格式的输出到sample/output.txt文件中。
$>zd.exe -d sample/common.yaml -y sample/test.yaml -c 15 -field field1 -o sample/output.txt -f text
执行数据生成命令。使用文件sample/test.yam覆盖默认配置sample/common.yaml中的内容。
\ No newline at end of file
$>zd.exe -y demo/test.yaml -c 15 -field field1 -o demo/output.txt -f text
执行数据生成命令。使用配置文件demo/test.yaml,生成15行数据,以text格式的输出到demo/output.txt文件中。
$>zd.exe -d demo/common.yaml -y demo/test.yaml -c 15 -field field1 -o demo/output.txt -f text
执行数据生成命令。使用文件demo/test.yam覆盖默认配置demo/common.yaml中的内容。
\ No newline at end of file
res/doc/usage.txt
浏览文件 @
8c45d0b1
-h
elp -h
查看帮助信息。
-s
et -s
设置工具语言属性。用户对当前目录需要有写权限。
-h
--help
查看帮助信息。
-s
--set
设置工具语言属性。用户对当前目录需要有写权限。
默认根据定义文件生成数据。
-d -default 默认定义文件
-y -yaml 指定定义文件
-c -count 指定生成数据的条数
-field
需要输出的字段,用逗号分隔。未指定时,默认输出-yaml文件中的所有字段。
-o -out 指定输出文件
-f format 输出格式,支持text、json、xml和sql语句,默认为text。
-t -table 输出格式为table时,用于指定insert语句的表名
-d -
-
default 默认定义文件
-y -
-
yaml 指定定义文件
-c -
-
count 指定生成数据的条数
--field
需要输出的字段,用逗号分隔。未指定时,默认输出-yaml文件中的所有字段。
-o -
-
out 指定输出文件
-f
--
format 输出格式,支持text、json、xml和sql语句,默认为text。
-t -
-
table 输出格式为table时,用于指定insert语句的表名
--verbose 增加此参数,显示详细调试信息。
为了方便在任意目录中执行%s命令,建议将其加入环境变量中,具体方法参照以下地址。
...
...
res/res.go
浏览文件 @
8c45d0b1
此差异已折叠。
点击以展开。
src/action/generator.go
浏览文件 @
8c45d0b1
...
...
@@ -25,7 +25,9 @@ func Generate(deflt string, yml string, total int, fieldsToExportStr string, out
rows
,
colTypes
:=
gen
.
GenerateForDefinition
(
deflt
,
yml
,
fieldsToExport
,
total
)
content
:=
Print
(
rows
,
format
,
table
,
colTypes
,
fieldsToExport
)
WriteToFile
(
out
,
content
)
if
out
!=
""
{
WriteToFile
(
out
,
content
)
}
entTime
:=
time
.
Now
()
.
Unix
()
logUtils
.
Screen
(
i118Utils
.
I118Prt
.
Sprintf
(
"generate_records"
,
len
(
rows
),
out
,
entTime
-
startTime
))
...
...
src/action/sql.go
浏览文件 @
8c45d0b1
...
...
@@ -32,9 +32,15 @@ func ParseSql(file string, out string) {
}
bytes
,
_
:=
yaml
.
Marshal
(
&
def
)
out
=
fileUtils
.
UpdateDir
(
out
)
outFile
:=
out
+
tableName
+
".yaml"
WriteToFile
(
outFile
,
string
(
bytes
))
content
:=
string
(
bytes
)
if
out
!=
""
{
out
=
fileUtils
.
UpdateDir
(
out
)
outFile
:=
out
+
tableName
+
".yaml"
WriteToFile
(
outFile
,
content
)
}
else
{
logUtils
.
Screen
(
content
)
}
}
entTime
:=
time
.
Now
()
.
Unix
()
...
...
src/zd.go
浏览文件 @
8c45d0b1
...
...
@@ -43,7 +43,7 @@ func main() {
flagSet
=
flag
.
NewFlagSet
(
"zd"
,
flag
.
ContinueOnError
)
flagSet
.
StringVar
(
&
deflt
,
"d"
,
""
,
""
)
flagSet
.
StringVar
(
&
deflt
,
"deflt"
,
""
,
""
)
flagSet
.
StringVar
(
&
deflt
,
"def
au
lt"
,
""
,
""
)
flagSet
.
StringVar
(
&
yml
,
"y"
,
""
,
""
)
flagSet
.
StringVar
(
&
yml
,
"yml"
,
""
,
""
)
...
...
@@ -80,7 +80,7 @@ func main() {
switch
os
.
Args
[
1
]
{
case
"-s"
,
"-set"
:
action
.
S
et
()
s
et
()
case
"-h"
,
"-help"
:
logUtils
.
PrintUsage
()
default
:
...
...
@@ -88,6 +88,10 @@ func main() {
}
}
func
set
()
{
action
.
Set
()
}
func
gen
(
args
[]
string
)
{
if
err
:=
flagSet
.
Parse
(
args
[
2
:
]);
err
==
nil
{
if
input
!=
""
{
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录