我正在尝试编译以下代码
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,
}
我在result.Commenter undefined (type []DataReponse has no field or method Commenter)这里收到错误是我的结构
//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"`
}
我如何使用结果值?
慕田峪9158850
慕斯709654
相关分类