I have two structs and one containing one field and other contains three fields:-
type User struct {
Name []CustomerDetails `json:"name" bson:"name"`
}
type CustomerDetails struct {
Value string `json:"value" bson:"value"`
Note string `json:"note" bson:"note"`
SendNotifications bool `json:"send_notifications" bson:"send_notifications"`
}
I want to access the CustomerDetails
fields using the User
struct field like
func main() {
var custName User
custName.Name.Value = "ABC"
fmt.Println(custName)
}
But It gives me the error of
custName.Name.Value undefined (type []CustomerDetails has no field or method Value)
How will I solve this error? Can anyone help me?