Database entities, retention and data mapping.
type User struct{
UserId int
Org int
Name string
Password string
Sex int
Age int
Avatar string
}
type Address struct{
AddressId int
UserId int
Province int
City int
District int
Address int
Description string
}
In DAO, I want to combine, cut, and expand the entity structure... for example:
type UserInfo struct{
User
[]Address
}
But the anonymous structure is embedded and can only be quoted in its entirety. How can I quote some fields?
type UserInfo struct{
User
[]Address
Password string `json:"-"`
Sex int `json:"-"`
Age int `json:"-"`
}