Documentation
¶
Index ¶
- Constants
- Variables
- func Find(tx *gorm.DB) (data []map[string]interface{}, err error)
- func GetUserAuthorityId(c *gin.Context) []int
- func GetUserID(c *gin.Context) int
- func GetUserUuid(c *gin.Context) uuid.UUID
- func LoadAll()
- type BaseClaims
- type Casbin
- func (c Casbin) Casbin() *casbin.SyncedEnforcer
- func (c Casbin) ClearCasbin(v int, p ...string) bool
- func (c Casbin) GetPolicyPathByAuthorityId(AuthorityID int) (pathMaps []CasbinInfo)
- func (c Casbin) UpdateCasbin(AuthorityID int, casbinInfos []CasbinInfo) error
- func (c Casbin) UpdateCasbinApi(oldPath string, newPath string, oldMethod string, newMethod string) error
- type CasbinInReceive
- type CasbinInfo
- type CustomClaims
- type ExaFile
- type ExaFileChunk
- type Jwt
- func (j *Jwt) CreateClaims(baseClaims BaseClaims) CustomClaims
- func (j *Jwt) CreateToken(claims CustomClaims) (string, error)
- func (j *Jwt) CreateTokenByOldToken(oldToken string, claims CustomClaims) (string, error)
- func (j *Jwt) GetRedisJWT(userName string) (redisJWT string, err error)
- func (j Jwt) JsonInBlacklist(jwtList SysJwtBlacklist) (err error)
- func (j *Jwt) ParseToken(tokenString string) (*CustomClaims, error)
- func (j *Jwt) SetRedisJWT(jwt string, userName string) (err error)
- type LocalTime
- type MODEL
- type MODEX_EXTEND
- type Meta
- type SysApi
- func (s SysApi) All() ([]SysApi, error)
- func (s *SysApi) Create() error
- func (s SysApi) Delete(ids []int) error
- func (s SysApi) GetAPIInfoList(api SysApi, info request.PageInfo, order string, desc bool) (list interface{}, total int64, err error)
- func (s SysApi) GetById(id int) (SysApi, error)
- func (s SysApi) IsExist(path, method string) bool
- func (SysApi) TableName() string
- func (s *SysApi) Update() error
- type SysAuthority
- func (s SysAuthority) CopyAuthority(copyInfo SysAuthorityCopyResponse) (SysAuthority, error)
- func (s SysAuthority) CreateAuthority(auth SysAuthority) (SysAuthority, error)
- func (s SysAuthority) DeleteAuthority(auth *SysAuthority) (err error)
- func (s SysAuthority) GetAuthorityInfoList(info request.PageInfo) (list interface{}, total int64, err error)
- func (s SysAuthority) SetDataAuthority(auth SysAuthority) error
- func (s SysAuthority) SetMenuAuthority(auth *SysAuthority) error
- func (SysAuthority) TableName() string
- func (s SysAuthority) UpdateAuthority(auth SysAuthority) (authority SysAuthority, err error)
- type SysAuthorityCopyResponse
- type SysAuthorityMenu
- type SysFileUploadAndDownload
- func (s SysFileUploadAndDownload) CreateFileChunk(id int, fileChunkPath string, fileChunkNumber int) error
- func (s SysFileUploadAndDownload) DeleteFile(file SysFileUploadAndDownload) (err error)
- func (s SysFileUploadAndDownload) DeleteFileChunk(fileMd5 string, filePath string) error
- func (s SysFileUploadAndDownload) EditFileName(file SysFileUploadAndDownload) (err error)
- func (s SysFileUploadAndDownload) FindFile(id int) (SysFileUploadAndDownload, error)
- func (s SysFileUploadAndDownload) FindOrCreateFile(fileMd5 string, fileName string, chunkTotal int) (file ExaFile, err error)
- func (s SysFileUploadAndDownload) GetFileRecordInfoList(info request.PageInfo) (list interface{}, total int64, err error)
- func (s SysFileUploadAndDownload) Upload(file *SysFileUploadAndDownload) error
- type SysJwtBlacklist
- type SysMenu
- func (s SysMenu) AddBaseMenu(menu SysMenu) error
- func (s SysMenu) DeleteBaseMenu(id int) (err error)
- func (s SysMenu) GetAllMenu(tree, loadSystem bool) ([]SysMenu, error)
- func (s SysMenu) GetAllTreeMenuByAuthorityId(authorityIds []int, tree bool) ([]SysMenu, error)
- func (s SysMenu) GetBaseMenuById(id int) (menu SysMenu, err error)
- func (s SysMenu) GetMenuByUserId(userId int, tree bool) ([]SysMenu, error)
- func (SysMenu) TableName() string
- func (s SysMenu) UpdateBaseMenu(menu SysMenu) (err error)
- type SysOperationRecord
- func (s SysOperationRecord) Create() (err error)
- func (s SysOperationRecord) DeleteSysOperationRecordByIds(ids []int) (err error)
- func (s *SysOperationRecord) GetSysOperationRecord(id int) (sysOperationRecord SysOperationRecord, err error)
- func (s SysOperationRecord) GetSysOperationRecordInfoList(info struct{ ... }) (list interface{}, total int64, err error)
- type SysUser
- func (s *SysUser) AfterUpdate(tx *gorm.DB) (err error)
- func (s SysUser) ChangePassword(newPassword string) (userInter *SysUser, err error)
- func (s SysUser) DeleteUser(id int) (err error)
- func (s SysUser) GetUserInfo(uuid uuid.UUID) (user SysUser, err error)
- func (s SysUser) GetUserInfoList(info request.PageInfo) (list interface{}, total int64, err error)
- func (s SysUser) Login(username, password string) (user *SysUser, err error)
- func (s SysUser) Register() (userInter SysUser, err error)
- func (s SysUser) ResetPassword() (err error)
- func (s SysUser) SetSelfInfo(req SysUser) error
- func (s SysUser) SetUserAuthorities(authorityIds []int) (err error)
- func (s SysUser) SetUserAuthority() (err error)
- func (s SysUser) SetUserInfo(req SysUser) error
- func (SysUser) TableName() string
- type SysUserAuthority
Constants ¶
View Source
const TimeFormat = "2006-01-02 15:04:05"
Variables ¶
Functions ¶
func GetUserAuthorityId ¶
Types ¶
type BaseClaims ¶
type Casbin ¶
type Casbin struct{}
func (Casbin) GetPolicyPathByAuthorityId ¶
func (c Casbin) GetPolicyPathByAuthorityId(AuthorityID int) (pathMaps []CasbinInfo)
获取权限列表
func (Casbin) UpdateCasbin ¶
func (c Casbin) UpdateCasbin(AuthorityID int, casbinInfos []CasbinInfo) error
更新 casbin 权限
type CasbinInReceive ¶
type CasbinInReceive struct {
AuthorityId int `json:"authorityId"` // 权限id
CasbinInfos []CasbinInfo `json:"casbinInfos"`
}
Casbin structure for input parameters
type CustomClaims ¶
type CustomClaims struct {
BaseClaims
BufferTime int64
jwt.StandardClaims
}
Custom claims structure
func GetUserInfo ¶
func GetUserInfo(c *gin.Context) *CustomClaims
type ExaFile ¶
type ExaFile struct {
MODEL
FileName string
FileMd5 string
FilePath string
ExaFileChunk []ExaFileChunk
ChunkTotal int
IsFinish bool
}
file struct, 文件结构体
type ExaFileChunk ¶
file chunk struct, 切片结构体
type Jwt ¶
type Jwt struct {
SigningKey []byte
}
func (*Jwt) CreateClaims ¶
func (j *Jwt) CreateClaims(baseClaims BaseClaims) CustomClaims
func (*Jwt) CreateToken ¶
func (j *Jwt) CreateToken(claims CustomClaims) (string, error)
func (*Jwt) CreateTokenByOldToken ¶
func (j *Jwt) CreateTokenByOldToken(oldToken string, claims CustomClaims) (string, error)
func (Jwt) JsonInBlacklist ¶
func (j Jwt) JsonInBlacklist(jwtList SysJwtBlacklist) (err error)
拉黑 jwt
func (*Jwt) ParseToken ¶
func (j *Jwt) ParseToken(tokenString string) (*CustomClaims, error)
解析 token
type MODEX_EXTEND ¶
type Meta ¶
type Meta struct {
ActiveName string `json:"activeName" gorm:"comment:高亮菜单"`
KeepAlive bool `json:"keepAlive" gorm:"comment:是否缓存"` // 是否缓存
DefaultMenu bool `json:"defaultMenu" gorm:"comment:是否是基础路由(开发中)"` // 是否是基础路由(开发中)
Title string `json:"title" gorm:"comment:菜单名"` // 菜单名
Icon string `json:"icon" gorm:"comment:菜单图标"` // 菜单图标
CloseTab bool `json:"closeTab" gorm:"comment:自动关闭tab"` // 自动关闭tab
SSRPath string `json:"SSRPath" gorm:"ssr_path"`
}
type SysApi ¶
type SysApi struct {
MODEL
Path string `json:"path" gorm:"comment:api路径"` // api路径
Description string `json:"description" gorm:"comment:api中文描述"` // api中文描述
ApiGroup string `json:"apiGroup" gorm:"comment:api组"` // api组
Method string `json:"method" gorm:"default:POST;comment:方法"` // 方法:创建POST(默认)|查看GET|更新PUT|删除DELETE
Sys bool `json:"sys" gorm:"-"`
}
func (SysApi) GetAPIInfoList ¶
type SysAuthority ¶
type SysAuthority struct {
CreatedAt time.Time // 创建时间
UpdatedAt time.Time // 更新时间
DeletedAt *time.Time `sql:"index"`
AuthorityId int `json:"authorityId" gorm:"not null;unique;primary_key;comment:角色ID;size:90"` // 角色ID
AuthorityName string `json:"authorityName" gorm:"comment:角色名"` // 角色名
ParentId *uint `json:"parentId" gorm:"comment:父角色ID"` // 父角色ID
DataAuthorityId []*SysAuthority `json:"dataAuthorityId" gorm:"many2many:sys_data_authority_id;"`
Children []SysAuthority `json:"children" gorm:"-"`
SysMenus []SysMenu `json:"menus" gorm:"many2many:sys_authority_menus;"`
Users []SysUser `json:"-" gorm:"many2many:sys_user_authority;"`
DefaultRouter string `json:"defaultRouter" gorm:"comment:默认菜单;default:defaultDashboard"` // 默认菜单(默认defaultDashboard)
}
func (SysAuthority) CopyAuthority ¶
func (s SysAuthority) CopyAuthority(copyInfo SysAuthorityCopyResponse) (SysAuthority, error)
func (SysAuthority) CreateAuthority ¶
func (s SysAuthority) CreateAuthority(auth SysAuthority) (SysAuthority, error)
func (SysAuthority) DeleteAuthority ¶
func (s SysAuthority) DeleteAuthority(auth *SysAuthority) (err error)
func (SysAuthority) GetAuthorityInfoList ¶
func (s SysAuthority) GetAuthorityInfoList(info request.PageInfo) (list interface{}, total int64, err error)
func (SysAuthority) SetDataAuthority ¶
func (s SysAuthority) SetDataAuthority(auth SysAuthority) error
func (SysAuthority) SetMenuAuthority ¶
func (s SysAuthority) SetMenuAuthority(auth *SysAuthority) error
func (SysAuthority) TableName ¶
func (SysAuthority) TableName() string
func (SysAuthority) UpdateAuthority ¶
func (s SysAuthority) UpdateAuthority(auth SysAuthority) (authority SysAuthority, err error)
type SysAuthorityCopyResponse ¶
type SysAuthorityCopyResponse struct {
Authority SysAuthority `json:"authority"`
OldAuthorityId int `json:"oldAuthorityId"` // 旧角色ID
}
type SysAuthorityMenu ¶
type SysAuthorityMenu struct {
MenuId int `json:"menuId" gorm:"comment:菜单ID;column:sys_menu_id"`
AuthorityId int `json:"-" gorm:"comment:角色ID;column:sys_authority_authority_id"`
}
func (SysAuthorityMenu) GetMenuIdsByAuthorityIds ¶
func (s SysAuthorityMenu) GetMenuIdsByAuthorityIds(ids []int) (menuIds []int)
func (SysAuthorityMenu) SaveAuthority ¶
func (s SysAuthorityMenu) SaveAuthority(authorityId int, menus []SysMenu) error
func (SysAuthorityMenu) TableName ¶
func (s SysAuthorityMenu) TableName() string
type SysFileUploadAndDownload ¶
type SysFileUploadAndDownload struct {
MODEL
Name string `json:"name" gorm:"comment:文件名"` // 文件名
Url string `json:"url" gorm:"comment:文件地址"` // 文件地址
Tag string `json:"tag" gorm:"comment:文件标签"` // 文件标签
Key string `json:"key" gorm:"comment:编号"` // 编号
}
func (SysFileUploadAndDownload) CreateFileChunk ¶
func (s SysFileUploadAndDownload) CreateFileChunk(id int, fileChunkPath string, fileChunkNumber int) error
func (SysFileUploadAndDownload) DeleteFile ¶
func (s SysFileUploadAndDownload) DeleteFile(file SysFileUploadAndDownload) (err error)
func (SysFileUploadAndDownload) DeleteFileChunk ¶
func (s SysFileUploadAndDownload) DeleteFileChunk(fileMd5 string, filePath string) error
func (SysFileUploadAndDownload) EditFileName ¶
func (s SysFileUploadAndDownload) EditFileName(file SysFileUploadAndDownload) (err error)
func (SysFileUploadAndDownload) FindFile ¶
func (s SysFileUploadAndDownload) FindFile(id int) (SysFileUploadAndDownload, error)
func (SysFileUploadAndDownload) FindOrCreateFile ¶
func (SysFileUploadAndDownload) GetFileRecordInfoList ¶
func (s SysFileUploadAndDownload) GetFileRecordInfoList(info request.PageInfo) (list interface{}, total int64, err error)
func (SysFileUploadAndDownload) Upload ¶
func (s SysFileUploadAndDownload) Upload(file *SysFileUploadAndDownload) error
type SysJwtBlacklist ¶
func (SysJwtBlacklist) IsBlack ¶
func (s SysJwtBlacklist) IsBlack(jwt string) bool
type SysMenu ¶
type SysMenu struct {
MODEL
AuthorityId int `json:"authorityId" gorm:"-"`
MenuLevel uint `json:"-"`
ParentId int `json:"parentId" gorm:"comment:父菜单ID"` // 父菜单ID
Path string `json:"path" gorm:"comment:路由path"` // 路由path
Name string `json:"name" gorm:"comment:路由name"` // 路由name
Hidden bool `json:"hidden" gorm:"comment:是否在列表隐藏"` // 是否在列表隐藏
Component string `json:"component" gorm:"comment:对应前端文件路径"` // 对应前端文件路径
Sort int `json:"sort" gorm:"comment:排序标记"` // 排序标记
Children []SysMenu `json:"children" gorm:"-"`
SysAuthoritys []SysAuthority `json:"authoritys" gorm:"many2many:sys_authority_menus;"`
Meta `json:"meta" gorm:"embedded;comment:附加属性"` // 附加属性
}
func (SysMenu) AddBaseMenu ¶
func (SysMenu) DeleteBaseMenu ¶
func (SysMenu) GetAllTreeMenuByAuthorityId ¶
func (SysMenu) GetMenuByUserId ¶
func (SysMenu) UpdateBaseMenu ¶
type SysOperationRecord ¶
type SysOperationRecord struct {
MODEL
Ip string `json:"ip" form:"ip" gorm:"column:ip;comment:请求ip"` // 请求ip
Method string `json:"method" form:"method" gorm:"column:method;comment:请求方法"` // 请求方法
Path string `json:"path" form:"path" gorm:"column:path;comment:请求路径"` // 请求路径
Status int `json:"status" form:"status" gorm:"column:status;comment:请求状态"` // 请求状态
Latency time.Duration `json:"latency" form:"latency" gorm:"column:latency;comment:延迟" swaggertype:"string"` // 延迟
Agent string `json:"agent" form:"agent" gorm:"column:agent;comment:代理"` // 代理
ErrorMessage string `json:"error_message" form:"error_message" gorm:"column:error_message;comment:错误信息"` // 错误信息
Body string `json:"body" form:"body" gorm:"type:text;column:body;comment:请求Body"` // 请求Body
Resp string `json:"resp" form:"resp" gorm:"type:text;column:resp;comment:响应Body"` // 响应Body
UserID int `json:"user_id" form:"user_id" gorm:"column:user_id;comment:用户id"` // 用户id
User SysUser `json:"user"`
}
如果含有time.Time 请自行import time包
func (SysOperationRecord) Create ¶
func (s SysOperationRecord) Create() (err error)
func (SysOperationRecord) DeleteSysOperationRecordByIds ¶
func (s SysOperationRecord) DeleteSysOperationRecordByIds(ids []int) (err error)
func (*SysOperationRecord) GetSysOperationRecord ¶
func (s *SysOperationRecord) GetSysOperationRecord(id int) (sysOperationRecord SysOperationRecord, err error)
func (SysOperationRecord) GetSysOperationRecordInfoList ¶
func (s SysOperationRecord) GetSysOperationRecordInfoList(info struct { SysOperationRecord request.PageInfo }) (list interface{}, total int64, err error)
type SysUser ¶
type SysUser struct {
MODEL
UUID uuid.UUID `json:"uuid" gorm:"index;comment:用户UUID"` // 用户UUID
Username string `json:"userName" gorm:"index;comment:用户登录名"` // 用户登录名
Password string `json:"-" gorm:"comment:用户登录密码"` // 用户登录密码
NickName string `json:"nickName" gorm:"default:系统用户;comment:用户昵称"` // 用户昵称
SideMode string `json:"sideMode" gorm:"default:dark;comment:用户侧边主题"` // 用户侧边主题
HeaderImg string `json:"headerImg" gorm:"comment:用户头像"` // 用户头像
BaseColor string `json:"baseColor" gorm:"default:#fff;comment:基础颜色"` // 基础颜色
ActiveColor string `json:"activeColor" gorm:"default:#1890ff;comment:活跃颜色"` // 活跃颜色
AuthorityId int `json:"authorityId" gorm:"default:0;comment:用户角色ID"` // 用户角色ID
Authority SysAuthority `json:"authority" gorm:"foreignKey:AuthorityId;references:AuthorityId;comment:用户角色"`
Authorities []SysAuthority `json:"authorities" gorm:"many2many:sys_user_authority;"`
Phone string `json:"phone" gorm:"comment:用户手机号"` // 用户手机号
Email string `json:"email" gorm:"comment:用户邮箱"` // 用户邮箱
Enable int `json:"enable" gorm:"default:1;comment:用户是否被冻结 1正常 2冻结"` //用户是否被冻结 1正常 2冻结
}
func (SysUser) ChangePassword ¶
func (SysUser) DeleteUser ¶
func (SysUser) GetUserInfoList ¶
func (SysUser) ResetPassword ¶
func (SysUser) SetSelfInfo ¶
func (SysUser) SetUserAuthorities ¶
func (SysUser) SetUserAuthority ¶
func (SysUser) SetUserInfo ¶
type SysUserAuthority ¶
type SysUserAuthority struct {
SysUserId int `gorm:"column:sys_user_id"`
SysAuthorityAuthorityId int `gorm:"column:sys_authority_authority_id"`
}
func (SysUserAuthority) GetAuthorityAuthorityIdByUserId ¶
func (s SysUserAuthority) GetAuthorityAuthorityIdByUserId(uid int) (aid []int)
func (SysUserAuthority) TableName ¶
func (s SysUserAuthority) TableName() string
Click to show internal directories.
Click to hide internal directories.