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

@@ -107,6 +107,10 @@ func (m *_Model) genTableElement(cols []ColumnsInfo) (el []genstruct.GenElement)
tmp.AddTag(_tagGorm, "not null")
}
}
// default tag
if len(v.Default) > 0 {
tmp.AddTag(_tagGorm, "default:"+v.Default)
}
// json tag
if config.GetIsWEBTag() {
@@ -116,6 +120,7 @@ func (m *_Model) genTableElement(cols []ColumnsInfo) (el []genstruct.GenElement)
tmp.AddTag(_tagJSON, mybigcamel.UnMarshal(v.Name))
}
}
}
el = append(el, tmp)