Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
易企天创
zendata
提交
34b67d9b
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 搜索 >>
提交
34b67d9b
编写于
9月 11, 2020
作者:
aaronchen2k2k
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
generate article yaml
上级
02737589
变更
4
隐藏空白更改
内联
并排
Showing
4 changed file
with
22 addition
and
3 deletion
+22
-3
src/model/definition.go
src/model/definition.go
+2
-0
test/article/convert_words_test.go
test/article/convert_words_test.go
+0
-0
test/article/generate_yaml_test.go
test/article/generate_yaml_test.go
+20
-3
tmp/cache/.words.db
tmp/cache/.words.db
+0
-0
未找到文件。
src/model/definition.go
浏览文件 @
34b67d9b
...
...
@@ -85,6 +85,7 @@ type FieldSimple struct {
LoopIndex
int
`yaml:"-"`
IsRand
bool
`yaml:"-"`
IsReferYaml
bool
`yaml:"-"`
UseLastSameValue
bool
`yaml:"-"`
}
type
FieldWithValues
struct
{
...
...
@@ -123,4 +124,5 @@ type DefFieldExport struct {
Where
string
`yaml:"where"`
Rand
bool
`yaml:"rand"`
Limit
int
`yaml:"limit"`
UseLastSameValue
bool
`yaml:"useLastSameValue"`
}
\ No newline at end of file
test/article/convert_test.go
→
test/article/convert_
words_
test.go
浏览文件 @
34b67d9b
文件已移动
test/article/generate_test.go
→
test/article/generate_
yaml_
test.go
浏览文件 @
34b67d9b
package
main
import
(
"fmt"
"github.com/easysoft/zendata/src/model"
constant
"github.com/easysoft/zendata/src/utils/const"
fileUtils
"github.com/easysoft/zendata/src/utils/file"
...
...
@@ -77,12 +78,28 @@ func createDef(typ, table string) (conf model.DefExport) {
func
createField
(
index
int
,
prefix
,
exp
string
)
(
field
model
.
DefFieldExport
)
{
field
.
Field
=
strconv
.
Itoa
(
index
)
field
.
Prefix
=
prefix
field
.
Select
=
getPinyin
(
exp
)
field
.
Where
=
"true"
field
.
Rand
=
true
field
.
Limit
=
1
// deal with exp like S:名词-姓+名词-名字=F
exp
=
strings
.
ToLower
(
strings
.
TrimSpace
(
exp
))
expArr
:=
[]
rune
(
exp
)
if
string
(
expArr
[
0
])
==
"s"
&&
(
string
(
expArr
[
1
])
==
":"
||
string
(
expArr
[
1
])
==
":"
)
{
exp
=
string
(
expArr
[
2
:
])
expArr
=
expArr
[
2
:
]
field
.
UseLastSameValue
=
true
}
if
strings
.
Index
(
exp
,
"="
)
==
len
(
exp
)
-
2
{
exp
=
string
(
expArr
[
:
len
(
expArr
)
-
2
])
field
.
Select
=
getPinyin
(
exp
)
field
.
Where
=
fmt
.
Sprintf
(
"%s = %s"
,
field
.
Select
,
string
(
expArr
[
len
(
expArr
)
-
1
]))
}
else
{
field
.
Select
=
getPinyin
(
exp
)
field
.
Where
=
"true"
}
return
}
...
...
tmp/cache/.words.db
浏览文件 @
34b67d9b
无法预览此类型文件
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录