fix SingularTable
This commit is contained in:
@@ -135,8 +135,12 @@ func (s *GenStruct) Generates() []string {
|
||||
}
|
||||
p.Add(s.Notes)
|
||||
p.Add("type", s.Name, "struct {")
|
||||
mp := make(map[string]bool, len(s.Em))
|
||||
for _, v := range s.Em {
|
||||
p.Add(v.Generate())
|
||||
if !mp[v.Name] {
|
||||
mp[v.Name] = true
|
||||
p.Add(v.Generate())
|
||||
}
|
||||
}
|
||||
p.Add("}")
|
||||
|
||||
|
||||
@@ -15,8 +15,8 @@ import (
|
||||
|
||||
// getCamelName Big Hump or Capital Letter.大驼峰或者首字母大写
|
||||
func getCamelName(name string) string {
|
||||
if config.GetSingularTable() { // If the table name plural is globally disabled.如果全局禁用表名复数
|
||||
return titleCase(name)
|
||||
if !config.GetSingularTable() { // If the table name plural is globally disabled.如果全局禁用表名复数
|
||||
return mybigcamel.Marshal(strings.TrimSuffix(name, "s"))
|
||||
}
|
||||
|
||||
return mybigcamel.Marshal(name)
|
||||
|
||||
Reference in New Issue
Block a user