fix TagSettings' map has "":"" value (#2372)

This commit is contained in:
Jony4 2019-04-05 08:00:48 +08:00 committed by Jinzhu
parent bc5d3f07a8
commit 071b657418
1 changed files with 3 additions and 0 deletions

View File

@ -625,6 +625,9 @@ func (scope *Scope) GetStructFields() (fields []*StructField) {
func parseTagSetting(tags reflect.StructTag) map[string]string { func parseTagSetting(tags reflect.StructTag) map[string]string {
setting := map[string]string{} setting := map[string]string{}
for _, str := range []string{tags.Get("sql"), tags.Get("gorm")} { for _, str := range []string{tags.Get("sql"), tags.Get("gorm")} {
if str == "" {
continue
}
tags := strings.Split(str, ";") tags := strings.Split(str, ";")
for _, value := range tags { for _, value := range tags {
v := strings.Split(value, ":") v := strings.Split(value, ":")