Documentation ¶
Index ¶
- func BaseData(context any, data interface{})
- func BaseDataCount(context any, count int64)
- func CheckPermission(context any, permissionMarks []string) bool
- func GetContext(context any) *gin.Context
- func GetContextBodyByte(context any) (dataByte []byte, b bool)
- func GetTokenID(c *gin.Context) int64
- func GetTokenInfo(c *gin.Context) (data BaseToken2.FieldsToken)
- func HeaderBase(c *gin.Context)
- func ReportActionCreate(context any, logMsg string, err error, code string, data interface{})
- func ReportActionCreateNoData(context any, logMsg string, err error, code string)
- func ReportActionDelete(context any, logMsg string, err error, code string)
- func ReportActionUpdate(context any, logMsg string, err error, code string)
- func ReportBaseBool(context any, code string, b bool)
- func ReportBaseDataList(context any, count int64, data interface{})
- func ReportBaseError(context any, code string)
- func ReportBaseSuccess(context any)
- func ReportData(context any, errMessage string, err error, code string, data interface{})
- func ReportDataList(context any, errMessage string, err error, code string, dataList interface{}, ...)
- func ReportDataNoErr(context any, err error, code string, data interface{})
- func ReportErrorBadRequest(context any, code string)
- func ReportErrorBadRequestLog(context any, message string, err error, code string)
- func ReportErrorBadRequestLogToParams(context any, message string, err error, code string, newMsg string)
- func ReportErrorLog(context any, message string, err error, code string)
- func ReportWarnLog(context any, message string, err error, code string)
- func TryGetUserID(c *gin.Context) (userID int64, b bool)
- func UpdateUserLogin(c *RouterURLHeaderC, userInfo *UserCore.FieldsUserType)
- type ArgsIOTData
- type DataGetContextData
- type RouterGlob
- type RouterURL
- func (t *RouterURL) Base(urlPath string) *RouterURL
- func (t *RouterURL) Header() *RouterURLHeader
- func (t *RouterURL) IOT() *RouterURLIOT
- func (t *RouterURL) Manager() *RouterURLUser
- func (t *RouterURL) OB() *RouterURLOrg
- func (t *RouterURL) OM() *RouterURLOrg
- func (t *RouterURL) Public() *RouterURLPublic
- func (t *RouterURL) Role(roleType string) *RouterURLRole
- func (t *RouterURL) Top(urlPath string) RouterURL
- func (t *RouterURL) User() *RouterURLUser
- type RouterURLHeader
- func (t *RouterURLHeader) DELETE(urlPath string, handle func(*RouterURLHeaderC))
- func (t *RouterURLHeader) GET(urlPath string, handle func(*RouterURLHeaderC))
- func (t *RouterURLHeader) POST(urlPath string, handle func(*RouterURLHeaderC))
- func (t *RouterURLHeader) PUT(urlPath string, handle func(*RouterURLHeaderC))
- type RouterURLHeaderC
- type RouterURLIOT
- type RouterURLIOTC
- type RouterURLManager
- type RouterURLOrg
- type RouterURLOrgC
- type RouterURLPublic
- func (t *RouterURLPublic) DELETE(urlPath string, handle func(*RouterURLPublicC))
- func (t *RouterURLPublic) GET(urlPath string, handle func(*RouterURLPublicC))
- func (t *RouterURLPublic) POST(urlPath string, handle func(*RouterURLPublicC))
- func (t *RouterURLPublic) PUT(urlPath string, handle func(*RouterURLPublicC))
- type RouterURLPublicC
- type RouterURLRole
- type RouterURLRoleC
- type RouterURLUser
- type RouterURLUserC
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func CheckPermission ¶
CheckPermission 检查权限 自动识别组织或用户
func GetContextBodyByte ¶
GetContextBodyByte 尝试获取上下文的body byte 由于设备验证和获取参数冲突,gin的body不能连续获取两次,会触发EOF错误
func GetTokenInfo ¶
func GetTokenInfo(c *gin.Context) (data BaseToken2.FieldsToken)
GetTokenInfo 获取会话数据包
func ReportActionCreate ¶
func ReportActionDelete ¶
func ReportActionUpdate ¶
func ReportBaseDataList ¶
ReportBaseDataList 反馈列队数据
func ReportData ¶
ReportData 通用反馈单一数据
func ReportDataList ¶
func ReportDataList(context any, errMessage string, err error, code string, dataList interface{}, dataCount int64)
ReportDataList 通用反馈列表方案
func ReportDataNoErr ¶
func ReportErrorBadRequest ¶
ReportErrorBadRequest 反馈错误但不带JSON重新标定
func ReportErrorBadRequestLogToParams ¶ added in v5.1.5
func ReportErrorLog ¶
ReportErrorLog 反馈错误并抛出日志
func ReportWarnLog ¶
ReportWarnLog 反馈警告并抛出错误
func UpdateUserLogin ¶
func UpdateUserLogin(c *RouterURLHeaderC, userInfo *UserCore.FieldsUserType)
UpdateUserLogin 用户登陆操作处理
Types ¶
type ArgsIOTData ¶
type ArgsIOTData struct { //设备分组 GroupMark string `db:"group_mark" json:"groupMark" check:"mark"` //设备编号 // 同一个分组下,必须唯一 Code string `db:"code" json:"code" check:"mark"` //时间戳 NowTime int64 `db:"now_time" json:"nowTime"` //随机码 Rand string `db:"rand" json:"rand"` //key计算结果 // key+code+时间戳+随机码 Key string `db:"key" json:"key"` //组织ID OrgID int64 `db:"org_id" json:"orgID" check:"id"` }
ArgsIOTData 检查设备是否存在且授权参数
type DataGetContextData ¶
type DataGetContextData struct { //日志头部 LogAppend string //用户ID UserID int64 //组织ID OrgID int64 //组织成员ID OrgBindID int64 }
DataGetContextData 识别和获取头部上下文并带数据结果
func GetContextData ¶
func GetContextData(context any) (c *gin.Context, result DataGetContextData)
GetContextData 识别和获取头部上下文并带数据
type RouterGlob ¶
type RouterGlob struct { //路由结构体 Routers *gin.RouterGroup // contains filtered or unexported fields }
RouterGlob 全局通用结构方法存储
type RouterURLHeader ¶
type RouterURLHeader struct { //全局方法 BaseData RouterGlob }
RouterURLHeader 有头级别路由
func (*RouterURLHeader) DELETE ¶
func (t *RouterURLHeader) DELETE(urlPath string, handle func(*RouterURLHeaderC))
func (*RouterURLHeader) GET ¶
func (t *RouterURLHeader) GET(urlPath string, handle func(*RouterURLHeaderC))
func (*RouterURLHeader) POST ¶
func (t *RouterURLHeader) POST(urlPath string, handle func(*RouterURLHeaderC))
func (*RouterURLHeader) PUT ¶
func (t *RouterURLHeader) PUT(urlPath string, handle func(*RouterURLHeaderC))
type RouterURLHeaderC ¶
type RouterURLHeaderC struct { //上下文 Context *gin.Context //日志头部 LogAppend string //会话ID TokenID int64 }
RouterURLHeaderC 普通级别头部
type RouterURLIOT ¶
type RouterURLIOT struct { //全局方法 BaseData RouterGlob }
RouterURLIOT IOT级别路由
func (*RouterURLIOT) DELETE ¶
func (t *RouterURLIOT) DELETE(urlPath string, handle func(*RouterURLIOTC))
func (*RouterURLIOT) GET ¶
func (t *RouterURLIOT) GET(urlPath string, handle func(*RouterURLIOTC))
func (*RouterURLIOT) POST ¶
func (t *RouterURLIOT) POST(urlPath string, handle func(*RouterURLIOTC))
func (*RouterURLIOT) PUT ¶
func (t *RouterURLIOT) PUT(urlPath string, handle func(*RouterURLIOTC))
type RouterURLIOTC ¶
type RouterURLIOTC struct { //上下文 Context *gin.Context //日志头部 LogAppend string //上下文参数数据集合 BodyByte []byte }
RouterURLIOTC 普通级别头部
type RouterURLManager ¶
type RouterURLManager struct { //全局方法 BaseData RouterGlob }
RouterURLManager 管理层级路由
type RouterURLOrg ¶
type RouterURLOrg struct { //全局方法 BaseData RouterGlob }
RouterURLOrg 组织级别路由
func (*RouterURLOrg) DELETE ¶
func (t *RouterURLOrg) DELETE(urlPath string, handle func(*RouterURLOrgC))
func (*RouterURLOrg) GET ¶
func (t *RouterURLOrg) GET(urlPath string, handle func(*RouterURLOrgC))
func (*RouterURLOrg) POST ¶
func (t *RouterURLOrg) POST(urlPath string, handle func(*RouterURLOrgC))
func (*RouterURLOrg) PUT ¶
func (t *RouterURLOrg) PUT(urlPath string, handle func(*RouterURLOrgC))
type RouterURLOrgC ¶
type RouterURLOrgC struct { //上下文 Context *gin.Context //日志头部 LogAppend string //用户ID UserID int64 //组织ID OrgID int64 //组织成员ID OrgBindID int64 }
RouterURLOrgC 普通级别头部
type RouterURLPublic ¶
type RouterURLPublic struct { //全局方法 BaseData RouterGlob }
RouterURLPublic 有头级别路由
func (*RouterURLPublic) DELETE ¶
func (t *RouterURLPublic) DELETE(urlPath string, handle func(*RouterURLPublicC))
func (*RouterURLPublic) GET ¶
func (t *RouterURLPublic) GET(urlPath string, handle func(*RouterURLPublicC))
func (*RouterURLPublic) POST ¶
func (t *RouterURLPublic) POST(urlPath string, handle func(*RouterURLPublicC))
func (*RouterURLPublic) PUT ¶
func (t *RouterURLPublic) PUT(urlPath string, handle func(*RouterURLPublicC))
type RouterURLPublicC ¶
RouterURLPublicC 普通级别头部
type RouterURLRole ¶
type RouterURLRole struct { //全局方法 BaseData RouterGlob //角色类型 RoleType string }
RouterURLRole 用户角色级别路由
func (*RouterURLRole) DELETE ¶
func (t *RouterURLRole) DELETE(urlPath string, handle func(*RouterURLRoleC))
func (*RouterURLRole) GET ¶
func (t *RouterURLRole) GET(urlPath string, handle func(*RouterURLRoleC))
func (*RouterURLRole) POST ¶
func (t *RouterURLRole) POST(urlPath string, handle func(*RouterURLRoleC))
func (*RouterURLRole) PUT ¶
func (t *RouterURLRole) PUT(urlPath string, handle func(*RouterURLRoleC))
type RouterURLRoleC ¶
type RouterURLRoleC struct { //上下文 Context *gin.Context //日志头部 LogAppend string //用户ID UserID int64 //RoleID RoleID int64 //角色类型 RoleType string }
RouterURLRoleC 用户角色头部
type RouterURLUser ¶
type RouterURLUser struct { //全局方法 BaseData RouterGlob }
RouterURLUser 用户级别路由
func (*RouterURLUser) DELETE ¶
func (t *RouterURLUser) DELETE(urlPath string, handle func(*RouterURLUserC))
func (*RouterURLUser) GET ¶
func (t *RouterURLUser) GET(urlPath string, handle func(*RouterURLUserC))
func (*RouterURLUser) POST ¶
func (t *RouterURLUser) POST(urlPath string, handle func(*RouterURLUserC))
func (*RouterURLUser) PUT ¶
func (t *RouterURLUser) PUT(urlPath string, handle func(*RouterURLUserC))