You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
23 lines
361 B
23 lines
361 B
package models
|
|
|
|
import (
|
|
"github.com/beego/beego/v2/client/orm"
|
|
)
|
|
|
|
type UsersRoles struct {
|
|
Id int64
|
|
UserId *User `orm:"column(user_id);rel(fk)"`
|
|
RoleId *Role `orm:"column(role_id);rel(fk)"`
|
|
}
|
|
|
|
func init() {
|
|
orm.RegisterModel(new(UsersRoles))
|
|
}
|
|
|
|
func AddUserRole(m *UsersRoles) (id int64, err error) {
|
|
o := orm.NewOrm()
|
|
id, err = o.Insert(m)
|
|
return
|
|
}
|
|
|
|
|
|
|