refactor: simplify the code (#1670)
This commit is contained in:
@@ -48,19 +48,14 @@ func RawFieldNames(in interface{}, postgresSql ...bool) []string {
|
|||||||
if strings.Contains(tagv, ",") {
|
if strings.Contains(tagv, ",") {
|
||||||
tagv = strings.TrimSpace(strings.Split(tagv, ",")[0])
|
tagv = strings.TrimSpace(strings.Split(tagv, ",")[0])
|
||||||
}
|
}
|
||||||
if tagv != "" {
|
if len(tagv) == 0 {
|
||||||
|
tagv = fi.Name
|
||||||
|
}
|
||||||
if pg {
|
if pg {
|
||||||
out = append(out, tagv)
|
out = append(out, tagv)
|
||||||
} else {
|
} else {
|
||||||
out = append(out, fmt.Sprintf("`%s`", tagv))
|
out = append(out, fmt.Sprintf("`%s`", tagv))
|
||||||
}
|
}
|
||||||
} else {
|
|
||||||
if pg {
|
|
||||||
out = append(out, fi.Name)
|
|
||||||
} else {
|
|
||||||
out = append(out, fmt.Sprintf("`%s`", fi.Name))
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user