18 lines
671 B
Go
18 lines
671 B
Go
package models
|
|
|
|
import (
|
|
"gorm.io/gorm"
|
|
"time"
|
|
)
|
|
|
|
// UserGroup 表示用户组模型
|
|
type UserGroup struct {
|
|
gorm.Model
|
|
Name string `json:"name" gorm:"uniqueIndex;not null"` // 用户组名称
|
|
Description string `json:"description"` // 用户组描述
|
|
CreatedAt time.Time `json:"created_at"` // 创建时间
|
|
UpdatedAt time.Time `json:"updated_at"` // 更新时间
|
|
Users []User `json:"users" gorm:"many2many:user_group_users;"` // 关联的用户
|
|
Roles []Role `json:"roles" gorm:"many2many:user_group_roles;"` // 关联的角色
|
|
}
|