Add first check field is embed

This commit is contained in:
Zufar Samigullin 2020-04-09 18:15:11 +03:00 committed by profbis
parent 7ea143b548
commit 93e915d471

View File

@ -220,7 +220,8 @@ func (scope *Scope) GetModelStruct() *ModelStruct {
}
fieldValue := reflect.New(indirectType).Interface()
if _, isScanner := fieldValue.(sql.Scanner); isScanner {
_, isEmbed := field.TagSettingsGet("EMBEDDED")
if _, isScanner := fieldValue.(sql.Scanner); isScanner && !isEmbed {
// is scanner
field.IsScanner, field.IsNormal = true, true
if indirectType.Kind() == reflect.Struct {
@ -235,7 +236,7 @@ func (scope *Scope) GetModelStruct() *ModelStruct {
} else if _, isTime := fieldValue.(*time.Time); isTime {
// is time
field.IsNormal = true
} else if _, ok := field.TagSettingsGet("EMBEDDED"); ok || fieldStruct.Anonymous {
} else if isEmbed || fieldStruct.Anonymous {
// is embedded struct
for _, subField := range scope.New(fieldValue).GetModelStruct().StructFields {
subField = subField.clone()