the data obtained from MySQL is as follows
[map[Uid:3 Avatar:12 Username:jack Level: Content:1212 Created_at:1540447583 Id:1] map[Username:jack Level: Content:1212 Created_at:1540447612 Id:2 Uid:3 Avatar:12]]
how to efficiently get the Uid collection in this array, and then use the Uid collection to look up the data in the user table and splice it together.
in addition, the demo I wrote myself is as follows
func (c *UserController) ChatMsgList() {
o := orm.NewOrm()
qs := o.QueryTable("chat_msg")
var list []orm.Params
qs.OrderBy("Id").Limit(2).Values(&list)
beego.Info(list)
var uids []int
//listUid
for key, value := range list {
beego.Info(key)
uids = append(uids, value["Uid"])
}
beego.Info(uids)
//c.Data["list"] = list
//
//c.TplName = "user/chatMsgList.html"
c.Data["json"] = list
c.ServeJSON()
}