add default set

添加默认值
This commit is contained in:
xxjwxc
2020-09-11 23:51:49 +08:00
parent 2ef0cca3d4
commit aa434356e0
9 changed files with 51 additions and 10 deletions

View File

@@ -52,3 +52,23 @@ func GetMysqlModel() model.IModel {
//now just support mysql
return &MySQLModel
}
// FixElementNote 分析元素表注释
func FixElementNote(em *model.ColumnsInfo, note string) {
matches := noteRegex.FindStringSubmatch(note)
if len(matches) < 2 {
em.Notes = note
return
}
em.Notes = note[len(matches[0]):]
list := strings.Split(matches[1], ";")
for _, v := range list {
tmp := strings.Split(v, ":")
if len(tmp) == 2 {
if strings.EqualFold(tmp[0], "default") { // 默认值
em.Default = tmp[1]
}
}
}
}