I have 2 structs whereby one inherits values that are common amongst all stucts denoted by type Common struct {...}
type Common struct{
Id int
CreatedAt time.Time
UpdatedAt time.Time
CreatorId int
}
type Post struct{
type Post struct{
Common
Status
Title string
ShortDescription string
Content string
CategoryIds []int
TagIds []int
Url string
MainImageId int
Keywords []string
}
However when I try to create a new instance of the Post struct as in the following.
post1 := &Post{
CreatorId: 1,
Status: 1,
Title: "this is the title of the first post",
ShortDescription: "this is the short description of this post",
Content: "",
Url: "first-post",
MainImageId: 1,
}
It does not recognise the CreatorId
field.
How would I reference this field in the new instance or modify the struct so that it registers CreatorID
as part of the Post
struct?
Thanks