Don't parse ignored anonymous field

This commit is contained in:
Jinzhu 2020-08-11 21:22:51 +08:00
parent 15b96ed3f4
commit a3dda47afa
1 changed files with 1 additions and 1 deletions

View File

@ -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