Skip to content

Instantly share code, notes, and snippets.

@leopard627
Created July 8, 2017 05:52
Show Gist options
  • Save leopard627/b55268ca308b5547b76f3597a917ff54 to your computer and use it in GitHub Desktop.
Save leopard627/b55268ca308b5547b76f3597a917ff54 to your computer and use it in GitHub Desktop.
Beego Practice..
func (this *TestController) Show3() {
o := orm.NewOrm()
var arc []*models.Archives
o.QueryTable("go_archives").Filter("Id__gt", 1).RelatedSel().All(&arc)//使用RelatedSel将关联的arctype也查出来,也就是left join arctype as T1 on T1.id=go_archives.arctype_id
arc3 := arc[0]
fmt.Println(arc3.Arctype.Typename)
}// 이런식으로해서
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment