Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type Dict ¶
type Dict struct { Id uint `gorm:"primaryKey;"` Name string `gorm:"type:varchar(100);"` Code string `gorm:"type:varchar(100);"` Data []DictData CreatedAt uint64 `gorm:"autoCreateTime:nano;"` UpdatedAt uint64 `gorm:"autoUpdateTime:nano;"` }
func (Dict) TableComment ¶
type DictData ¶
type DictData struct { Id uint `gorm:"primaryKey;"` Name string `gorm:"type:varchar(100);comment:data name;"` Key string `gorm:"type:varchar(100);uniqueIndex;comment:data key;"` Value string `gorm:"type:varchar(255);comment:data value;"` Type uint8 `gorm:"comment:data type"` Order int `gorm:"comment:order flag;"` CreatedAt uint64 `gorm:"autoCreateTime:nano;"` UpdatedAt uint64 `gorm:"autoUpdateTime:nano;"` DeletedAt gorm.DeletedAt `gorm:"index;comment:disable status;"` DictId uint `gorm:"comment:dict type reference key;"` }
func (DictData) TableComment ¶
type Permission ¶
type Permission struct { PermissionTable Id uint `gorm:"primarykey"` Name string `gorm:"type:varchar(50);comment:perm name;"` Object string `gorm:"type:varchar(100);uniqueIndex:perm;comment:resource will be accessed;"` Action string `gorm:"type:varchar(50);uniqueIndex:perm;comment:resource action;"` Group string `gorm:"type:varchar(30);uniqueIndex:perm;comment:permission group;"` Tag string `gorm:"type:varchar(30);uniqueIndex:perm;comment:perm's tag,define type of perm;"` CreatedAt uint64 `gorm:"autoCreateTime:nano;"` UpdatedAt uint64 `gorm:"autoUpdateTime:nano;"` Roles []Role `gorm:"many2many:role_permission;"` }
Permission app permissions record table
type PermissionTable ¶
type PermissionTable struct{}
func (PermissionTable) BeforeCreate ¶
func (p PermissionTable) BeforeCreate(db *gorm.DB) error
func (PermissionTable) TableComment ¶
func (p PermissionTable) TableComment() string
func (PermissionTable) TableName ¶
func (p PermissionTable) TableName() string
type Role ¶
type Role struct { RoleTable Id uint `gorm:"primarykey"` Name string `gorm:"type:varchar(50);comment:role display name;"` Code string `gorm:"type:varchar(50);uniqueIndex;comment:role code;"` CreatedAt uint64 `gorm:"autoCreateTime:nano;"` UpdatedAt uint64 `gorm:"autoUpdateTime:nano;"` Perms []Permission `gorm:"many2many:role_permission;"` Users []User `gorm:"many2many:users_roles;"` }
Role app roles record table
type RolePermission ¶
type RolePermission struct { PermissionId uint `gorm:"primaryKey;comment:id of permission;"` Permission Permission `gorm:"foreignKey:PermissionId;"` RoleId uint `gorm:"primaryKey;comment:id of role;"` Role Role `gorm:"foreignKey:RoleId;"` RolePermissionTable }
RolePermission role-permission relation table
func (RolePermission) BeforeCreate ¶
func (r RolePermission) BeforeCreate(db *gorm.DB) error
type RolePermissionTable ¶
type RolePermissionTable struct{}
func (RolePermissionTable) TableComment ¶
func (r RolePermissionTable) TableComment() string
func (RolePermissionTable) TableName ¶
func (r RolePermissionTable) TableName() string
type User ¶
type User struct { UserTable Id uint `gorm:"primaryKey;"` UUID string `gorm:"uniqueIndex;type:varchar(70);comment:User UUID;"` Username string `gorm:"uniqueIndex;type:varchar(50);comment:username;"` Password string `gorm:"comment:User password;type:varchar(255);"` Email string `gorm:"uniqueIndex;type:varchar(80);comment:User concat email;"` CreatedAt uint64 `gorm:"autoCreateTime:nano;"` UpdatedAt uint64 `gorm:"autoUpdateTime:nano;"` Roles []Role `gorm:"many2many:users_roles;"` }
User user entity represents from database table
type UserRole ¶
type UserRole struct { UserId uint `gorm:"primaryKey;comment:id of user who own role;"` User User `gorm:"foreignKey:UserId;"` RoleId uint `gorm:"primaryKey;comment:id of role;"` Role Role `gorm:"foreignKey:RoleId;"` UserRoleTable }
UserRole user-role relation table
type UserRoleTable ¶
type UserRoleTable struct{}
func (UserRoleTable) BeforeCreate ¶
func (u UserRoleTable) BeforeCreate(db *gorm.DB) error
func (UserRoleTable) TableComment ¶
func (u UserRoleTable) TableComment() string
func (UserRoleTable) TableName ¶
func (u UserRoleTable) TableName() string
Click to show internal directories.
Click to hide internal directories.