Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
易企天创
zendata
提交
b7a92a2d
Z
zendata
项目概览
易企天创
/
zendata
8 个月 前同步成功
通知
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 搜索 >>
提交
b7a92a2d
编写于
8月 11, 2020
作者:
aaronchen2k2k
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
fix issue#3348
上级
e3795036
变更
6
展开全部
隐藏空白更改
内联
并排
Showing
6 changed file
with
30 addition
and
22 deletion
+30
-22
demo/default.yaml
demo/default.yaml
+9
-3
res/en/usage.txt
res/en/usage.txt
+7
-6
res/res.go
res/res.go
+6
-6
src/utils/config/config.go
src/utils/config/config.go
+3
-3
src/utils/file/file.go
src/utils/file/file.go
+3
-2
src/utils/log/print.go
src/utils/log/print.go
+2
-2
未找到文件。
demo/default.yaml
浏览文件 @
b7a92a2d
...
...
@@ -43,12 +43,18 @@ desc:
# select: 如果引用的文件是excel表,可以查询里面的某一个字段。
# where: 如果引用的文件是excel表,可以使用查询条件。
# loop定义
# 可以使用一个数字来指定字段循环的次数,比如loop:2。
# 可以使用区间来定义字段循环的次数。比如loop:2-10。
# range定义
# 使用逗号连接不同的元素。比如 range: 1,2,3
# 元素也可以是一个区间。比如 range:1-10, A-Z
# 使用逗号连接不同的元素。比如 range: 1,2,3
。
# 元素也可以是一个区间。比如 range:1-10, A-Z
。
# 区间可以通过冒号:来指定步长。比如 range:1-10:2。
# 步长可以是小数。比如 range: 1-10:0.1
# 步长可以是小数。比如 range: 1-10:0.1。
# 步长可以是负数。比如 range:100-1:-1。
# 区间可以通过R来指定随机。比如 range: 1-10:R,随机和步长只能二选一。
# 可以通过一个文件来指定列表。比如range: list.txt。文件名是相对路径时,以配置文件为基准计算。
# 可以通过{n}的方式来重复某一个元素。比如 range: user1{100},user2{100}
...
...
res/en/usage.txt
浏览文件 @
b7a92a2d
...
...
@@ -48,15 +48,16 @@ $>zd.exe -d demo/default.yaml -o test.sql -t user -s mysql --trim # Remove th
$>zd.exe -i demo/zentao.sql -o db # Generate YAML files for each table by parsing zentao.sql.
$>zd.exe -c demo/default.yaml -i test.txt --decode # Parse the file specified by -i according to the config of -d.
$>zd.exe -l # List all build-in data types.
$>zd.exe -v system.address.v1 # View data types in build-in Excel file system/address/v1.xlsx.
$>zd.exe -v system.address.v1.china # View data items in Excel sheet "china".
$>zd.exe -v system.ip.v1.yaml # View data items in build-in instances。
$>zd.exe -l
# List all build-in data types.
$>zd.exe -v system.address.v1
# View data types in build-in Excel file system/address/v1.xlsx.
$>zd.exe -v system.address.v1.china
# View data items in Excel sheet "china".
$>zd.exe -v system.ip.v1.yaml
# View data items in build-in instances。
Service Example:
$zd.exe -p 80 # Listen port 80. Use the directory of zd.exe as the root.
$zd.exe -p 80 -R d:\zd\config # Listen port 80. Use d:\zd\config as the root.
$zd.exe -p 80 # Listen port 80. Use the directory of zd.exe as the root.
$zd.exe -p 80 -R d:\zd\config # Listen port 80. Use d:\zd\config as the root.
/home/user/zd/config
Client Call:
...
...
res/res.go
浏览文件 @
b7a92a2d
此差异已折叠。
点击以展开。
src/utils/config/config.go
浏览文件 @
b7a92a2d
...
...
@@ -20,19 +20,19 @@ import (
func
InitConfig
()
{
vari
.
ExeDir
=
fileUtils
.
GetExeDir
()
CheckConfigPermission
()
constant
.
ConfigFile
=
vari
.
ExeDir
+
constant
.
ConfigFile
if
commonUtils
.
IsWin
()
{
shellUtils
.
ExeShell
(
"chcp 65001"
)
}
constant
.
ConfigFile
=
vari
.
ExeDir
+
constant
.
ConfigFile
vari
.
Config
=
getInst
()
i118Utils
.
InitI118
(
vari
.
Config
.
Language
)
}
func
SaveConfig
(
conf
model
.
Config
)
error
{
fileUtils
.
MkDirIfNeeded
(
fileUtils
.
GetExeDir
()
+
"conf"
)
fileUtils
.
MkDirIfNeeded
(
vari
.
ExeDir
+
"conf"
)
conf
.
Version
=
constant
.
ConfigVer
...
...
@@ -74,7 +74,7 @@ func ReadCurrConfig() model.Config {
return
config
}
ini
.
MapTo
(
&
config
,
con
stant
.
ConfigFile
)
ini
.
MapTo
(
&
config
,
con
figPath
)
return
config
}
...
...
src/utils/file/file.go
浏览文件 @
b7a92a2d
package
fileUtils
import
(
"fmt"
"github.com/easysoft/zendata/res"
commonUtils
"github.com/easysoft/zendata/src/utils/common"
constant
"github.com/easysoft/zendata/src/utils/const"
...
...
@@ -116,7 +117,7 @@ func GetExeDir() string { // where zd.exe file in
arg1
:=
strings
.
ToLower
(
os
.
Args
[
0
])
name
:=
filepath
.
Base
(
arg1
)
if
strings
.
Index
(
name
,
"z
tf
"
)
==
0
&&
strings
.
Index
(
arg1
,
"go-build"
)
<
0
{
if
strings
.
Index
(
name
,
"z
d
"
)
==
0
&&
strings
.
Index
(
arg1
,
"go-build"
)
<
0
{
p
,
_
:=
exec
.
LookPath
(
os
.
Args
[
0
])
if
strings
.
Index
(
p
,
string
(
os
.
PathSeparator
))
>
-
1
{
dir
=
p
[
:
strings
.
LastIndex
(
p
,
string
(
os
.
PathSeparator
))]
...
...
@@ -128,7 +129,7 @@ func GetExeDir() string { // where zd.exe file in
dir
,
_
=
filepath
.
Abs
(
dir
)
dir
=
AddSepIfNeeded
(
dir
)
//
fmt.Printf("Debug: Launch %s in %s \n", arg1, dir)
fmt
.
Printf
(
"Debug: Launch %s in %s
\n
"
,
arg1
,
dir
)
return
dir
}
...
...
src/utils/log/print.go
浏览文件 @
b7a92a2d
...
...
@@ -45,8 +45,8 @@ func PrintUsage() {
regx
,
_
=
regexp
.
Compile
(
`zd.exe`
)
usage
=
regx
.
ReplaceAllString
(
usage
,
"zd"
)
regx
,
_
=
regexp
.
Compile
(
`d:`
)
usage
=
regx
.
ReplaceAllString
(
usage
,
"/home/user"
)
regx
,
_
=
regexp
.
Compile
(
`d:
/zd/config
`
)
usage
=
regx
.
ReplaceAllString
(
usage
,
"/home/user
/zd/config
"
)
}
fmt
.
Printf
(
"%s
\n
"
,
usage
)
}
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录