You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
例如官方的样例中:
Post 和 Tag 是 ManyToMany 关系
设置 rel(m2m) 以后,ORM会自动创建中间表
type Post struct {
Id int
Title string
User _User orm:"rel(fk)"
Tags []_Tag orm:"rel(m2m)"
}
type Tag struct {
Id int
Name string
Posts []*Post orm:"reverse(many)"
}
通过 tag name 查询哪些 post 使用了这个 tag
var posts []*Post
num, err := dORM.QueryTable("post").Filter("Tags__Tag__Name", "golang").All(&posts)
通过 post title 查询这个 post 有哪些 tag
var tags []*Tag
num, err := dORM.QueryTable("tag").Filter("Posts__Post__Title", "Introduce Beego ORM").All(&tags)
usermodel里面的
Filter() 里面两个参数 “Role_Role_id” 和roleid 为什么可以这样写
"Role_Role_Id" 这个字符串对应的是什么意思
The text was updated successfully, but these errors were encountered: