diff --git a/field_test.go b/field_test.go index d19b3b1b..2172b059 100644 --- a/field_test.go +++ b/field_test.go @@ -11,6 +11,11 @@ type CalculateField struct { Name string Children []CalculateFieldChild Category CalculateFieldCategory + EmbeddedField +} + +type EmbeddedField struct { + EmbeddedName string `sql:"NOT NULL;DEFAULT:'hello'"` } type CalculateFieldChild struct { @@ -31,4 +36,10 @@ func TestCalculateField(t *testing.T) { if fields["children"].Relationship == nil || fields["category"].Relationship == nil { t.Errorf("Should calculate fields correctly for the first time") } + + if field, ok := fields["embedded_name"]; !ok { + t.Errorf("should find embedded field") + } else if _, ok := field.TagSettings["NOT NULL"]; !ok { + t.Errorf("should find embedded field's tag settings") + } } diff --git a/model_struct.go b/model_struct.go index fd7f1324..d80165c8 100644 --- a/model_struct.go +++ b/model_struct.go @@ -79,6 +79,7 @@ func (structField *StructField) clone() *StructField { IsScanner: structField.IsScanner, HasDefaultValue: structField.HasDefaultValue, Tag: structField.Tag, + TagSettings: structField.TagSettings, Struct: structField.Struct, IsForeignKey: structField.IsForeignKey, Relationship: structField.Relationship,