Suppose I have the following code:
type User struct {
ID string
Username string
Name string
Password string
}
What I want to do is create another struct that can access certain fields from the User struct, instead of accessing all of it, to prevent people from seeing the password, for example. This does not work:
type Note struct {
ID string
Text string
UserID User.ID
}
Is there any way to do this, or do I simply create the Note.UserID field to have the same data type as the ID in the User struct?