Skip to content

Commit 93405c9

Browse files
committed
Updated logic makeEmbeddedComments with support of deep embedding of struct composition.
1 parent 1a6c14d commit 93405c9

File tree

1 file changed

+8
-0
lines changed

1 file changed

+8
-0
lines changed

database/comment.go

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -67,6 +67,14 @@ func makeEmbeddedComments(ctx context.Context, sc SchemeCommenter, tableName str
6767
for i := 0; i < t.NumField(); i++ {
6868
fieldType := t.Field(i)
6969

70+
if fieldType.Anonymous {
71+
if err := makeEmbeddedComments(ctx, sc, tableName, fieldType.Type); err != nil {
72+
return err
73+
}
74+
75+
continue
76+
}
77+
7078
if fieldType.Name == "tableName" {
7179
return errors.New("Embedded type must not have tableName field.")
7280
}

0 commit comments

Comments
 (0)