rbac/models/models.go
zhangkun9038@dingtalk.com 9ac7597a62 first add
2025-02-16 12:18:39 +08:00

29 lines
494 B
Go

package models
import "gorm.io/gorm"
type User struct {
gorm.Model
Username string `gorm:"unique"`
Password string
Roles []Role `gorm:"many2many:user_roles;"`
}
type Role struct {
gorm.Model
Name string `gorm:"unique"`
Permissions []Permission `gorm:"many2many:role_permissions;"`
}
type Permission struct {
gorm.Model
Name string `gorm:"unique"`
}
type UserGroup struct {
gorm.Model
Name string `gorm:"unique"`
Users []User `gorm:"many2many:user_group_users;"`
}
`