From a3dda47afac01b7430efb200d27473e24fe2fca9 Mon Sep 17 00:00:00 2001 From: Jinzhu Date: Tue, 11 Aug 2020 21:22:51 +0800 Subject: [PATCH] Don't parse ignored anonymous field --- schema/field.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/schema/field.go b/schema/field.go index 1ca4cb6d..ea6364a4 100644 --- a/schema/field.go +++ b/schema/field.go @@ -311,7 +311,7 @@ func (schema *Schema) ParseField(fieldStruct reflect.StructField) *Field { } } - if _, ok := field.TagSettings["EMBEDDED"]; ok || (fieldStruct.Anonymous && !isValuer) { + if _, ok := field.TagSettings["EMBEDDED"]; ok || (fieldStruct.Anonymous && !isValuer && (field.Creatable || field.Updatable || field.Readable)) { if reflect.Indirect(fieldValue).Kind() == reflect.Struct { var err error field.Creatable = false