type BasePost struct {
    Id    int64
    Title string
    URL   string
}

type Author struct {
    ID    string
    Name  string
    Email string
}

type HNPost struct {
    BasePost
    Author  `gorm:"embedded_prefix:user_"` // Embedded struct
    Upvotes int32
}

type EngadgetPost struct {
    BasePost BasePost `gorm:"embedded"`
    Author   Author   `gorm:"embedded;embedded_prefix:author_"` // Embedded struct
    ImageUrl string
}
continue reading on github.com

โš ๏ธ This post links to an external website. โš ๏ธ