ot_monitor_rules.go 6.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138
  1. package dto
  2. import (
  3. "go-admin/app/admin/models"
  4. "go-admin/common/dto"
  5. common "go-admin/common/models"
  6. )
  7. type OtMonitorRulesGetPageReq struct {
  8. dto.Pagination `search:"-"`
  9. Kind string `form:"kind" search:"type:exact;column:kind;table:ot_monitor_rules" comment:"所属分类:trace,metric,log"`
  10. Group string `form:"group" search:"type:exact;column:group;table:ot_monitor_rules" comment:"子类型,聚类筛选,可自添加"`
  11. Name string `form:"name" search:"type:exact;column:name;table:ot_monitor_rules" comment:"事件项名称,不可重复"`
  12. MonitorAlias string `form:"monitorAlias" search:"type:exact;column:monitor_alias;table:ot_monitor_rules" comment:"监控项别名"`
  13. DataSource string `form:"dataSource" search:"type:exact;column:data_source;table:ot_monitor_rules" comment:"数据源"`
  14. Verify int64 `form:"verify" search:"type:exact;column:verify;table:ot_monitor_rules" comment:"是否验证成功"`
  15. Power int64 `form:"power" search:"type:exact;column:power;table:ot_monitor_rules" comment:"是否启用"`
  16. AppID int64 `form:"appId" search:"type:or;column:app_id;table:ap"`
  17. OtMonitorRulesOrder
  18. }
  19. type OtMonitorRulesOrder struct {
  20. Id string `form:"idOrder" search:"type:order;column:id;table:ot_monitor_rules"`
  21. Kind string `form:"kindOrder" search:"type:order;column:kind;table:ot_monitor_rules"`
  22. Group string `form:"groupOrder" search:"type:order;column:group;table:ot_monitor_rules"`
  23. Name string `form:"nameOrder" search:"type:order;column:name;table:ot_monitor_rules"`
  24. MonitorAlias string `form:"monitorAliasOrder" search:"type:order;column:monitor_alias;table:ot_monitor_rules"`
  25. DataSource string `form:"dataSourceOrder" search:"type:order;column:data_source;table:ot_monitor_rules"`
  26. Table string `form:"tableOrder" search:"type:order;column:table;table:ot_monitor_rules"`
  27. ValueType string `form:"valueTypeOrder" search:"type:order;column:value_type;table:ot_monitor_rules"`
  28. Expression string `form:"expressionOrder" search:"type:order;column:expression;table:ot_monitor_rules"`
  29. Interval string `form:"intervalOrder" search:"type:order;column:interval;table:ot_monitor_rules"`
  30. Verify string `form:"verifyOrder" search:"type:order;column:verify;table:ot_monitor_rules"`
  31. Power string `form:"powerOrder" search:"type:order;column:power;table:ot_monitor_rules"`
  32. CreatedAt string `form:"createdAtOrder" search:"type:order;column:created_at;table:ot_monitor_rules"`
  33. UpdatedAt string `form:"updatedAtOrder" search:"type:order;column:updated_at;table:ot_monitor_rules"`
  34. DeletedAt string `form:"deletedAtOrder" search:"type:order;column:deleted_at;table:ot_monitor_rules"`
  35. CreateBy string `form:"createByOrder" search:"type:order;column:create_by;table:ot_monitor_rules"`
  36. UpdateBy string `form:"updateByOrder" search:"type:order;column:update_by;table:ot_monitor_rules"`
  37. }
  38. func (m *OtMonitorRulesGetPageReq) GetNeedSearch() interface{} {
  39. return *m
  40. }
  41. type OtMonitorRulesInsertReq struct {
  42. Id int `json:"-" comment:"(链路)事件监控规则表"` // (链路)事件监控规则表
  43. Kind string `json:"kind" comment:"所属分类:trace,metric,log"`
  44. Group string `json:"group" comment:"子类型,聚类筛选,可自添加"`
  45. Name string `json:"name" comment:"事件项名称,不可重复"`
  46. MonitorAlias string `json:"monitorAlias" comment:"监控项别名"`
  47. DataSource string `json:"dataSource" comment:"数据源"`
  48. Table string `json:"table" comment:"表名"`
  49. ValueType string `json:"valueType" comment:"值类型"`
  50. Expression string `json:"expression" comment:"表达式"`
  51. Interval int64 `json:"interval" comment:"探测周期"`
  52. Verify int64 `json:"verify" comment:"是否验证成功"`
  53. Power int64 `json:"power" comment:"是否启用"`
  54. common.ControlBy
  55. }
  56. func (s *OtMonitorRulesInsertReq) Generate(model *models.OtMonitorRules) {
  57. if s.Id == 0 {
  58. model.Model = common.Model{Id: s.Id}
  59. }
  60. model.Kind = s.Kind
  61. model.Group = s.Group
  62. model.Name = s.Name
  63. model.MonitorAlias = s.MonitorAlias
  64. model.DataSource = s.DataSource
  65. model.Table = s.Table
  66. model.ValueType = s.ValueType
  67. model.Expression = s.Expression
  68. model.Interval = s.Interval
  69. model.Verify = s.Verify
  70. model.Power = s.Power
  71. model.CreateBy = s.CreateBy // 添加这而,需要记录是被谁创建的
  72. }
  73. func (s *OtMonitorRulesInsertReq) GetId() interface{} {
  74. return s.Id
  75. }
  76. type OtMonitorRulesUpdateReq struct {
  77. Id int `uri:"id" comment:"(链路)事件监控规则表"` // (链路)事件监控规则表
  78. Kind string `json:"kind" comment:"所属分类:trace,metric,log"`
  79. Group string `json:"group" comment:"子类型,聚类筛选,可自添加"`
  80. Name string `json:"name" comment:"事件项名称,不可重复"`
  81. MonitorAlias string `json:"monitorAlias" comment:"监控项别名"`
  82. DataSource string `json:"dataSource" comment:"数据源"`
  83. Table string `json:"table" comment:"表名"`
  84. ValueType string `json:"valueType" comment:"值类型"`
  85. Expression string `json:"expression" comment:"表达式"`
  86. Interval int64 `json:"interval" comment:"探测周期"`
  87. Verify int64 `json:"verify" comment:"是否验证成功"`
  88. Power int64 `json:"power" comment:"是否启用"`
  89. common.ControlBy
  90. }
  91. func (s *OtMonitorRulesUpdateReq) Generate(model *models.OtMonitorRules) {
  92. if s.Id == 0 {
  93. model.Model = common.Model{Id: s.Id}
  94. }
  95. model.Kind = s.Kind
  96. model.Group = s.Group
  97. model.Name = s.Name
  98. model.MonitorAlias = s.MonitorAlias
  99. model.DataSource = s.DataSource
  100. model.Table = s.Table
  101. model.ValueType = s.ValueType
  102. model.Expression = s.Expression
  103. model.Interval = s.Interval
  104. model.Verify = s.Verify
  105. model.Power = s.Power
  106. model.UpdateBy = s.UpdateBy // 添加这而,需要记录是被谁更新的
  107. }
  108. func (s *OtMonitorRulesUpdateReq) GetId() interface{} {
  109. return s.Id
  110. }
  111. // OtMonitorRulesGetReq 功能获取请求参数
  112. type OtMonitorRulesGetReq struct {
  113. Id int `uri:"id"`
  114. }
  115. func (s *OtMonitorRulesGetReq) GetId() interface{} {
  116. return s.Id
  117. }
  118. // OtMonitorRulesDeleteReq 功能删除请求参数
  119. type OtMonitorRulesDeleteReq struct {
  120. Ids []int `json:"ids"`
  121. }
  122. func (s *OtMonitorRulesDeleteReq) GetId() interface{} {
  123. return s.Ids
  124. }