I'm trying to compile the following piece of code
var result []DataReponse
if result.Commenter == "teacher"{
sender = models.CommentUser{
Name:result.UserName,
Email:result.UserEmail,
}
}else{
sender = models.CommentUser{
Name:result.ChildName,
Email:result.ChildEmail,
}
I am receiving the error result.Commenter undefined (type []DataReponse has no field or method Commenter)
here is my struct
//DataReponse is the structure of the response
type DataReponse struct{
CommentText string `json:"comment_text"`
Commenter string `json:"commenter"`
ChildEmail core.NullString `json:"child_email"`
ChildName core.NullString `json:"child_name"`
UserName core.NullString `json:"user_name"`
UserEmail core.NullString `json:"user_email"`
}
how can i use result values ?