Documentation ¶
Index ¶
- Variables
- func CreateIndex(args *ArgsCreateIndex) (err error)
- func CreateIndexParam(args *ArgsCreateIndexParam) (err error)
- func CreateIndexRelation(args *ArgsCreateIndexRelation) (err error)
- func DeleteIndex(id int64) (err error)
- func DeleteIndexParam(id int64) (err error)
- func DeleteIndexRelation(id int64) (err error)
- func GetIndexNameByCode(code string) (name string)
- func GetIndexNameByID(id int64) (name string)
- func GetIndexParamValByIndexCode(indexCode string, code string) (result string)
- func Init() (err error)
- func UpdateIndex(args *ArgsUpdateIndex) (err error)
- func UpdateIndexParam(args *ArgsUpdateIndexParam) (err error)
- func UpdateIndexRelation(args *ArgsUpdateIndexRelation) (err error)
- func UpdateIndexRelationAutoWeight(id, autoWeight int64) (err error)
- type ArgsCreateIndex
- type ArgsCreateIndexParam
- type ArgsCreateIndexRelation
- type ArgsGetIndexList
- type ArgsGetIndexParamList
- type ArgsGetIndexRelationList
- type ArgsUpdateIndex
- type ArgsUpdateIndexParam
- type ArgsUpdateIndexRelation
- type DataGetIndexAll
- type DataGetIndexListByTop
- type FieldsIndex
- type FieldsIndexParam
- type FieldsIndexRelation
- func GetIndexByRelationCode(topCode string) (dataList []FieldsIndexRelation, err error)
- func GetIndexByRelationID(topID int64) (dataList []FieldsIndexRelation, err error)
- func GetIndexRelationByCode(parentID, indexID int64) (data FieldsIndexRelation, err error)
- func GetIndexRelationList(args *ArgsGetIndexRelationList) (dataList []FieldsIndexRelation, dataCount int64, err error)
Constants ¶
This section is empty.
Variables ¶
var ( //OpenSub 是否启动订阅 OpenSub = false )
Functions ¶
func CreateIndexParam ¶
func CreateIndexParam(args *ArgsCreateIndexParam) (err error)
CreateIndexParam 创建新的指标
func CreateIndexRelation ¶
func CreateIndexRelation(args *ArgsCreateIndexRelation) (err error)
CreateIndexRelation 创建指标关系
func GetIndexNameByCode ¶
GetIndexNameByCode 获取指标名称
func GetIndexParamValByIndexCode ¶ added in v5.3.0
GetIndexParamValByIndexCode 获取指定编码参数
func UpdateIndexParam ¶
func UpdateIndexParam(args *ArgsUpdateIndexParam) (err error)
UpdateIndexParam 更新指标定义
func UpdateIndexRelation ¶
func UpdateIndexRelation(args *ArgsUpdateIndexRelation) (err error)
UpdateIndexRelation 更新指标定义
func UpdateIndexRelationAutoWeight ¶ added in v5.2.38
UpdateIndexRelationAutoWeight 仅修改算法权重值
Types ¶
type ArgsCreateIndex ¶
type ArgsCreateIndex struct { //指标编码 Code string `db:"code" json:"code" check:"des" min:"1" max:"50" index:"true"` //指标名称 Name string `db:"name" json:"name" check:"des" min:"1" max:"300" index:"true" field_search:"true" field_list:"true"` //是否内置 // 前端应拦截内置指标的删除操作,以免影响系统正常运行,启动重启后将自动恢复,所以删除操作是无法生效的 // 通过接口应强制给予false IsSystem bool `db:"is_system" json:"isSystem" index:"true"` //指标描述 Description string `db:"description" json:"description" check:"des" min:"1" max:"100" field_search:"true" field_list:"true" empty:"true"` //指标决策建议 Decision string `db:"decision" json:"decision" check:"des" min:"1" max:"-1" empty:"true" field_search:"true"` //指标预警阈值 // 0-100,归一化后的数据,超出此范围将可触发预警事件记录 Threshold int64 `db:"threshold" json:"threshold" index:"true"` //是否启用 // 关闭后将不对该指标进行汇总运算 // 通过接口应强制给予false IsEnable bool `db:"is_enable" json:"isEnable" index:"true"` }
ArgsCreateIndex 创建新的指标参数
type ArgsCreateIndexParam ¶
type ArgsCreateIndexParam struct { //指标ID IndexID int64 `db:"index_id" json:"indexID" check:"id" index:"true"` //参数名称 Name string `db:"name" json:"name" check:"des" min:"1" max:"50" field_search:"true" field_list:"true"` //参数编码 // 用于程序内识别内置指标的参数 Code string `db:"code" json:"code" check:"des" min:"1" max:"50" field_search:"true" field_list:"true"` //参数值 ParamVal string `db:"param_val" json:"paramVal"` }
ArgsCreateIndexParam 创建新的指标参数
type ArgsCreateIndexRelation ¶
type ArgsCreateIndexRelation struct { //指标ID // 上级指标 IndexID int64 `db:"index_id" json:"indexID" check:"id"` //关联指标 // 禁出现嵌套关系,系统将检查并报错 RelationIndexID int64 `db:"relation_index_id" json:"relationIndexID" check:"id"` //指标权重占比 // 同一个indexID下,所有指标的权重总和必须为1,否则计算的结果将出现异常 Weight int64 `db:"weight" json:"weight" check:"int64Than0"` //算法自动权重 // 同一个indexID下,所有指标的权重总和必须为1,否则计算的结果将出现异常 // 接口不能设置该参数,必须程序化内置实现 AutoWeight int64 `db:"auto_weight" json:"autoWeight" check:"int64Than0"` //是否启动算法自动权重 // 接口不能设置该参数,必须程序化内置实现 IsAutoWeight bool `db:"is_auto_weight" json:"isAutoWeight"` }
ArgsCreateIndexRelation 创建指标关系参数
type ArgsGetIndexList ¶
type ArgsGetIndexList struct { //分页 Pages CoreSQL2.ArgsPages `json:"pages"` //是否内置 // 前端应拦截内置指标的删除操作,以免影响系统正常运行,启动重启后将自动恢复,所以删除操作是无法生效的 NeedIsSystem bool `json:"needIsSystem"` IsSystem bool `db:"is_system" json:"isSystem" index:"true" field_list:"true"` //是否删除 IsRemove bool `db:"is_remove" json:"isRemove" check:"bool"` //搜索 Search string `json:"search" check:"search" empty:"true"` }
ArgsGetIndexList 获取指标列表参数
type ArgsGetIndexParamList ¶
type ArgsGetIndexParamList struct { //分页 Pages CoreSQL2.ArgsPages `json:"pages"` //指标ID IndexID int64 `json:"indexID" check:"id" empty:"true"` //是否删除 IsRemove bool `db:"is_remove" json:"isRemove" check:"bool"` //搜索 Search string `json:"search" check:"search" empty:"true"` }
ArgsGetIndexParamList 获取指标列表参数
type ArgsGetIndexRelationList ¶
type ArgsGetIndexRelationList struct { //分页 Pages CoreSQL2.ArgsPages `json:"pages"` //指标ID IndexID int64 `json:"indexID" check:"id" empty:"true"` //是否删除 IsRemove bool `db:"is_remove" json:"isRemove" check:"bool"` //搜索 Search string `json:"search" check:"search" empty:"true"` }
ArgsGetIndexRelationList 获取指标关系列表参数
type ArgsUpdateIndex ¶
type ArgsUpdateIndex struct { // ID ID int64 `db:"id" json:"id" check:"id" unique:"true"` //指标名称 Name string `db:"name" json:"name" check:"des" min:"1" max:"300" index:"true" field_search:"true" field_list:"true"` //指标描述 Description string `db:"description" json:"description" check:"des" min:"1" max:"100" field_search:"true" field_list:"true" empty:"true"` //指标决策建议 Decision string `db:"decision" json:"decision" check:"des" min:"1" max:"-1" empty:"true" field_search:"true"` //指标预警阈值 // 0-100,归一化后的数据,超出此范围将可触发预警事件记录 Threshold int64 `db:"threshold" json:"threshold" index:"true"` //是否启用 // 关闭后将不对该指标进行汇总运算 IsEnable bool `db:"is_enable" json:"isEnable" index:"true"` }
ArgsUpdateIndex 更新指标定义参数
type ArgsUpdateIndexParam ¶
type ArgsUpdateIndexParam struct { // ID ID int64 `db:"id" json:"id" check:"id" unique:"true"` //参数值 ParamVal string `db:"param_val" json:"paramVal"` }
ArgsUpdateIndexParam 更新指标定义参数
type ArgsUpdateIndexRelation ¶
type ArgsUpdateIndexRelation struct { // ID ID int64 `db:"id" json:"id" check:"id" unique:"true"` //指标权重占比 // 同一个indexID下,所有指标的权重总和必须为1,否则计算的结果将出现异常 Weight int64 `db:"weight" json:"weight" check:"int64Than0"` //是否启动算法自动权重 // 接口不能设置该参数,必须程序化内置实现 IsAutoWeight bool `db:"is_auto_weight" json:"isAutoWeight"` }
ArgsUpdateIndexRelation 更新指标定义参数
type DataGetIndexAll ¶
type DataGetIndexAll struct { // ID ID int64 `db:"id" json:"id" check:"id" unique:"true"` //指标编码 Code string `db:"code" json:"code" check:"des" min:"1" max:"50" index:"true"` //指标名称 Name string `db:"name" json:"name" check:"des" min:"1" max:"300" index:"true" field_search:"true" field_list:"true"` //是否内置 // 前端应拦截内置指标的删除操作,以免影响系统正常运行,启动重启后将自动恢复,所以删除操作是无法生效的 IsSystem bool `db:"is_system" json:"isSystem" index:"true" field_list:"true"` //指标描述 Description string `db:"description" json:"description" check:"des" min:"1" max:"-1" field_search:"true" field_list:"true" empty:"true"` //指标决策建议 Decision string `db:"decision" json:"decision" check:"des" min:"1" max:"-1" empty:"true" field_search:"true"` //指标预警阈值 // 0-100,归一化后的数据,超出此范围将可触发预警事件记录 Threshold int64 `db:"threshold" json:"threshold" index:"true"` //是否启用 // 关闭后将不对该指标进行汇总运算 IsEnable bool `db:"is_enable" json:"isEnable" index:"true" field_list:"true"` //子指标 SubIndex []DataGetIndexAll `json:"subIndex"` }
DataGetIndexAll 获取所有指标
type DataGetIndexListByTop ¶
type DataGetIndexListByTop struct { //指标ID IndexID int64 `db:"index_id" json:"indexID" check:"id" unique:"true"` //指标编码 Code string `db:"code" json:"code" check:"des" min:"1" max:"50" index:"true"` //指标名称 Name string `db:"name" json:"name" check:"des" min:"1" max:"300" index:"true" field_search:"true" field_list:"true"` //指标描述 Description string `db:"description" json:"description" check:"des" min:"1" max:"100" field_search:"true" field_list:"true" empty:"true"` //指标决策建议 Decision string `db:"decision" json:"decision" check:"des" min:"1" max:"-1" empty:"true" field_search:"true"` }
DataGetIndexListByTop 获取指标列表顶部数据
func GetIndexListByTop ¶
func GetIndexListByTop() (dataList []DataGetIndexListByTop, dataCount int64, err error)
GetIndexListByTop 获取指标列表顶部
type FieldsIndex ¶
type FieldsIndex struct { // ID ID int64 `db:"id" json:"id" check:"id" unique:"true"` //创建时间 CreateAt time.Time `db:"create_at" json:"createAt" default:"now()"` //更新时间 UpdateAt time.Time `db:"update_at" json:"updateAt" default:"now()"` //删除时间 DeleteAt time.Time `db:"delete_at" json:"deleteAt" default:"0" index:"true"` //指标编码 Code string `db:"code" json:"code" check:"des" min:"1" max:"50" index:"true"` //指标名称 Name string `db:"name" json:"name" check:"des" min:"1" max:"300" index:"true" field_search:"true" field_list:"true"` //是否内置 // 前端应拦截内置指标的删除操作,以免影响系统正常运行,启动重启后将自动恢复,所以删除操作是无法生效的 IsSystem bool `db:"is_system" json:"isSystem" index:"true" field_list:"true"` //指标描述 Description string `db:"description" json:"description" check:"des" min:"1" max:"-1" field_search:"true" field_list:"true" empty:"true"` //指标决策建议 Decision string `db:"decision" json:"decision" check:"des" min:"1" max:"-1" empty:"true" field_search:"true"` //指标预警阈值 // 0-100,归一化后的数据,超出此范围将可触发预警事件记录 Threshold int64 `db:"threshold" json:"threshold" index:"true"` //是否启用 // 关闭后将不对该指标进行汇总运算 IsEnable bool `db:"is_enable" json:"isEnable" index:"true" field_list:"true"` }
FieldsIndex 指标定义
func GetIndexByCode ¶
func GetIndexByCode(code string) (data FieldsIndex, err error)
GetIndexByCode 通过编码获取指标
func GetIndexList ¶
func GetIndexList(args *ArgsGetIndexList) (dataList []FieldsIndex, dataCount int64, err error)
GetIndexList 获取指标列表
type FieldsIndexParam ¶
type FieldsIndexParam struct { // ID ID int64 `db:"id" json:"id" check:"id" unique:"true"` //创建时间 CreateAt time.Time `db:"create_at" json:"createAt" default:"now()"` //更新时间 UpdateAt time.Time `db:"update_at" json:"updateAt" default:"now()"` //删除时间 DeleteAt time.Time `db:"delete_at" json:"deleteAt" default:"0" index:"true"` //指标ID IndexID int64 `db:"index_id" json:"indexID" check:"id" index:"true" field_list:"true"` //参数名称 Name string `db:"name" json:"name" check:"des" min:"1" max:"50" field_search:"true" field_list:"true"` //参数编码 // 用于程序内识别内置指标的参数 Code string `db:"code" json:"code" check:"des" min:"1" max:"50" index:"true" field_search:"true" field_list:"true"` //参数值 ParamVal string `db:"param_val" json:"paramVal"` }
FieldsIndexParam 参数定义 仅适用于内置指标
func GetIndexParamByCode ¶
func GetIndexParamByCode(indexID int64, code string) (data FieldsIndexParam, err error)
GetIndexParamByCode 获取指定编码参数
func GetIndexParamByIndexCode ¶
func GetIndexParamByIndexCode(indexCode string, code string) (data FieldsIndexParam, err error)
GetIndexParamByIndexCode 获取指定编码参数
func GetIndexParamList ¶
func GetIndexParamList(args *ArgsGetIndexParamList) (dataList []FieldsIndexParam, dataCount int64, err error)
GetIndexParamList 获取指标列表
type FieldsIndexRelation ¶
type FieldsIndexRelation struct { // ID ID int64 `db:"id" json:"id" check:"id" unique:"true"` //创建时间 CreateAt time.Time `db:"create_at" json:"createAt" default:"now()"` //更新时间 UpdateAt time.Time `db:"update_at" json:"updateAt" default:"now()"` //删除时间 DeleteAt time.Time `db:"delete_at" json:"deleteAt" default:"0" index:"true"` //指标ID // 上级指标 IndexID int64 `db:"index_id" json:"indexID" check:"id" field_list:"true"` //关联指标 // 禁出现嵌套关系,系统将检查并报错 RelationIndexID int64 `db:"relation_index_id" json:"relationIndexID" check:"id" field_list:"true"` //指标权重占比 // 同一个indexID下,所有指标的权重总和必须为1,否则计算的结果将出现异常 // 注意在底层使用时,需转为浮点数并/10000 Weight int64 `db:"weight" json:"weight" check:"int64Than0"` //算法自动权重 // 同一个indexID下,所有指标的权重总和必须为1,否则计算的结果将出现异常 // 注意在底层使用时,需转为浮点数并/10000 AutoWeight int64 `db:"auto_weight" json:"autoWeight" check:"int64Than0"` //是否启动算法自动权重 IsAutoWeight bool `db:"is_auto_weight" json:"isAutoWeight" field_list:"true"` }
FieldsIndexRelation 指标组合关系
func GetIndexByRelationCode ¶ added in v5.2.38
func GetIndexByRelationCode(topCode string) (dataList []FieldsIndexRelation, err error)
GetIndexByRelationCode 获取指标下的所有子指标 只能获取下一个层级所有指标
func GetIndexByRelationID ¶ added in v5.2.38
func GetIndexByRelationID(topID int64) (dataList []FieldsIndexRelation, err error)
GetIndexByRelationID 获取指标下的所有子指标 只能获取下一个层级所有指标
func GetIndexRelationByCode ¶
func GetIndexRelationByCode(parentID, indexID int64) (data FieldsIndexRelation, err error)
GetIndexRelationByCode 获取指标关系
func GetIndexRelationList ¶
func GetIndexRelationList(args *ArgsGetIndexRelationList) (dataList []FieldsIndexRelation, dataCount int64, err error)
GetIndexRelationList 获取指标列表