添加一个将所有的数据转化成大写的函数,并在模板中添加一些常量 #60

Merged
lunny merged 2 commits from bjzhang03/bjzhang_xormcmd into master 2019-04-26 08:06:18 +00:00
3 changed files with 15 additions and 6 deletions

View File

@ -20,11 +20,12 @@ var (
supportComment bool
GoLangTmpl LangTmpl = LangTmpl{
template.FuncMap{"Mapper": mapper.Table2Obj,
"Type": typestring,
"Tag": tag,
"UnTitle": unTitle,
"gt": gt,
"getCol": getCol,
"Type": typestring,
"Tag": tag,
"UnTitle": unTitle,
"gt": gt,
"getCol": getCol,
"UpperTitle": upTitle,
},
formatGo,
genGoImports,

View File

@ -55,3 +55,11 @@ func unTitle(src string) string {
return strings.ToLower(string(src[0])) + src[1:]
}
}
func upTitle(src string) string {
if src == "" {
return ""
}
return strings.ToUpper(src)
}

View File

@ -13,5 +13,5 @@ type {{Mapper .Name}} struct {
{{range .ColumnsSeq}}{{$col := $table.GetColumn .}} {{Mapper $col.Name}} {{Type $col}} {{Tag $table $col}}
{{end}}
}
{{end}}
{{end}}