milvus/internal/metastore/db/dbmodel/user_role.go
SimFG ce434b496e
Implement the mysql metastore of the rbac (#18704)
Signed-off-by: SimFG <bang.fu@zilliz.com>

Signed-off-by: SimFG <bang.fu@zilliz.com>
2022-08-23 10:26:53 +08:00

22 lines
490 B
Go

package dbmodel
type UserRole struct {
Base
UserID int64 `gorm:"user_id"`
RoleID int64 `gorm:"role_id"`
User User `gorm:"foreignKey:UserID"`
Role Role `gorm:"foreignKey:RoleID"`
}
func (u *UserRole) TableName() string {
return "user_role"
}
//go:generate mockery --name=IUserRoleDb
type IUserRoleDb interface {
GetUserRoles(tenantID string, userID int64, roleID int64) ([]*UserRole, error)
Insert(in *UserRole) error
Delete(tenantID string, userID int64, roleID int64) error
}