diff --git a/migration_test.go b/migration_test.go index 7fdf7bf8..30085263 100644 --- a/migration_test.go +++ b/migration_test.go @@ -117,7 +117,7 @@ type Company struct { } type Role struct { - Name string + Name string `gorm:"size:256"` } func (role *Role) Scan(value interface{}) error { diff --git a/model_struct.go b/model_struct.go index d6a71c0b..d9e84c3c 100644 --- a/model_struct.go +++ b/model_struct.go @@ -188,6 +188,13 @@ func (scope *Scope) GetModelStruct() *ModelStruct { if _, isScanner := fieldValue.(sql.Scanner); isScanner { // is scanner field.IsScanner, field.IsNormal = true, true + if indirectType.Kind() == reflect.Struct { + for i := 0; i < indirectType.NumField(); i++ { + for key, value := range parseTagSetting(indirectType.Field(i).Tag) { + field.TagSettings[key] = value + } + } + } } else if _, isTime := fieldValue.(*time.Time); isTime { // is time field.IsNormal = true