gorm执行sql

gorm执行sql

type Object interface {
  GroupOrderOpenlog() (uidList []int)
}
func (o *object) GroupOrderOpenlog() {
	type res struct {
		Uid int `json:"uid"`
	}
	var re []res
	sql:= "SELECT uid FROM order_openlog  GROUP BY uid"
	o.Db.Raw(sql).Scan(&re)
	fmt.Println(re)
	for _,k :=range re{
		fmt.Println(k.Uid)
	}
}
posted @ 2022-01-06 11:46  Jeff的技术栈  阅读(261)  评论(0编辑  收藏  举报
回顶部