添加一个将所有的数据转化成大写的函数,并在模板中添加一些常量 #60
11
xorm/go.go
11
xorm/go.go
|
@ -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,
|
||||
|
|
|
@ -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)
|
||||
}
|
||||
|
|
|
@ -13,5 +13,5 @@ type {{Mapper .Name}} struct {
|
|||
{{range .ColumnsSeq}}{{$col := $table.GetColumn .}} {{Mapper $col.Name}} {{Type $col}} {{Tag $table $col}}
|
||||
{{end}}
|
||||
}
|
||||
{{end}}
|
||||
|
||||
{{end}}
|
Reference in New Issue
Block a user