Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type AdminMenu ¶
type AdminMenu struct {
Model
Icon *string `gorm:"type:string;comment:图标"`
Name string `gorm:"type:string;not null;comment:菜单名称"`
Path *string `gorm:"type:string;comment:菜单路由"`
Order uint `gorm:"type:uint;default:0;not null;commit:排序"`
ParentID *uint
Parent *AdminMenu `gorm:"foreignKey:ParentID"`
Children []AdminMenu `gorm:"foreignKey:ParentID"`
Roles []*AdminRole `gorm:"many2many:admin_menu_roles;joinForeignKey:menu_id;joinReferences:role_id"`
}
type AdminPermission ¶
type AdminPermission struct {
Model
Name *string `gorm:"type:string;comment:权限名称"`
Flag string `gorm:"type:string;not null;comment:权限标识"`
Method string `gorm:"type:string;default:'ANY';comment:请求方法"`
Path string `gorm:"type:string;not null;comment:请求路由"`
Order uint `gorm:"type:uint;default:0;not null;commit:排序"`
ParentID *uint
Parent *AdminPermission `gorm:"foreignKey:ParentID"`
Children []AdminPermission `gorm:"foreignKey:ParentID"`
Roles []*AdminRole `gorm:"many2many:admin_permission_roles;joinForeignKey:permission_id;joinReferences:role_id"`
}
type AdminRole ¶
type AdminRole struct {
Model
Name *string `gorm:"type:string;comment:角色名称"`
Flag string `gorm:"type:string;not null;comment:角色标记"`
Users []*AdminUser `gorm:"many2many:admin_role_users;joinForeignKey:role_id;joinReferences:user_id"`
Menus []*AdminMenu `gorm:"many2many:admin_menu_roles;joinForeignKey:role_id;joinReferences:menu_id"`
Permissions []*AdminPermission `gorm:"many2many:admin_permission_roles;joinForeignKey:role_id;joinReferences:permission_id"`
}
type AdminUser ¶
type AdminUser struct {
Model
Username *string `gorm:"type:string;uniqueIndex;comment:用户名"`
Password string `gorm:"type:string;comment:密码"`
Email *string `gorm:"type:string;uniqueIndex;comment:邮箱"`
Nickname *string `gorm:"type:string;default:'';comment:昵称"`
Avatar *string `gorm:"type:string;default:'';comment:头像"`
Roles []*AdminRole `gorm:"many2many:admin_role_users;joinForeignKey:user_id;joinReferences:role_id"`
}
type TestArticle ¶
type TestArticle struct {
Model
Title string `gorm:"type:string;default:'';not null;commit:标题"`
Content *string `gorm:"type:text;commit:内容"`
CategoryID *uint
Category *TestCategory `gorm:"foreignKey:CategoryID"`
UserID *uint
User *TestUser `gorm:"foreignKey:UserID"`
Comments []TestComment `gorm:"foreignKey:ArticleID"`
}
type TestCategory ¶
type TestCategory struct {
Model
Name string `gorm:"type:string;default:'';not null;comment:类别名称"`
Order uint `gorm:"type:uint;default:0;not null;commit:排序"`
ParentID *uint
Parent *TestCategory `gorm:"foreignKey:ParentID"`
Children []TestCategory `gorm:"foreignKey:ParentID"`
UserID *uint
User *TestUser `gorm:"foreignKey:UserID"`
Articles []TestArticle `gorm:"foreignKey:CategoryID"`
}
type TestComment ¶
type TestComment struct {
Model
Content *string `gorm:"type:text;comment:评论内容"`
UserID *uint
User *TestUser `gorm:"foreignKey:UserID"`
ArticleID *uint
Article *TestArticle `gorm:"foreignKey:ArticleID"`
ParentID *uint
Parent *TestComment `gorm:"foreignKey:ParentID"`
Children []TestComment `gorm:"foreignKey:ParentID"`
}
type TestUser ¶
type TestUser struct {
Model
Username *string `gorm:"type:string;uniqueIndex;comment:用户名"`
Password string `gorm:"type:string;comment:密码"`
Email *string `gorm:"type:string;uniqueIndex;comment:邮箱"`
UserInfo TestUserInfo `gorm:"foreignKey:UserID"`
Categories []TestCategory `gorm:"foreignKey:UserID"`
Articles []TestArticle `gorm:"foreignKey:UserID"`
Comments []TestComment `gorm:"foreignKey:UserID"`
}
type TestUserInfo ¶
type User ¶
type User struct {
Model
Username *string `gorm:"type:string;uniqueIndex;comment:用户名"`
Password string `gorm:"type:string;comment:密码"`
Email *string `gorm:"type:string;uniqueIndex;comment:邮箱"`
Nickname *string `gorm:"type:string;default:'';comment:昵称"`
Avatar *string `gorm:"type:string;default:'';comment:头像"`
}
Click to show internal directories.
Click to hide internal directories.