Documentation ¶
Index ¶
- Variables
- func CheckCondition(condition Condition) bool
- func CheckRule(rule Rule) bool
- func DalGetAllWebhookConfig() ([]*tuple, error)
- func InitSystemVars()
- type Condition
- type OPCNodeVarsDFT
- func (s *OPCNodeVarsDFT) AddNode(node *OpcNode) error
- func (s *OPCNodeVarsDFT) DeleteNode(id int64) error
- func (s *OPCNodeVarsDFT) GetNode(id int64) (*OpcNode, error)
- func (s *OPCNodeVarsDFT) GetNodeByName(name string) (*OpcNode, error)
- func (s *OPCNodeVarsDFT) GetValueByName(name string) (interface{}, error)
- func (s *OPCNodeVarsDFT) Save() error
- type OpcNode
- type Rule
- type WebHookConditions
- type WebHookConfig
Constants ¶
This section is empty.
Variables ¶
View Source
var ( Debug bool = false OPCNodeVars *OPCNodeVarsDFT WebHooks *WebHookConditions )
View Source
var OpcWriteLock = &sync.Mutex{}
View Source
var WebHookWriteLock = &sync.Mutex{}
Functions ¶
func CheckCondition ¶
func DalGetAllWebhookConfig ¶
func DalGetAllWebhookConfig() ([]*tuple, error)
func InitSystemVars ¶
func InitSystemVars()
Types ¶
type OPCNodeVarsDFT ¶
type OPCNodeVarsDFT struct { TimeStamp time.Time CurrentNodes map[int64]*OpcNode // 0 node1, 1 node2, 2 node3... CurrentValues map[int64]interface{} // 0 value1, 1 value2, 2 value3... NodeNameSets map[string]struct{} // set of node names NodeIdSets map[string]struct{} // set of node ids golang中没有集合 nodeid unique NodeIdList []string // list of node ids NodeNameIndex map[string]int64 // node name to index in CurrentValues node name 索引 }
func NewGlobalOPCNodeVars ¶
func NewGlobalOPCNodeVars() *OPCNodeVarsDFT
func (*OPCNodeVarsDFT) AddNode ¶
func (s *OPCNodeVarsDFT) AddNode(node *OpcNode) error
func (*OPCNodeVarsDFT) DeleteNode ¶
func (s *OPCNodeVarsDFT) DeleteNode(id int64) error
func (*OPCNodeVarsDFT) GetNodeByName ¶
func (s *OPCNodeVarsDFT) GetNodeByName(name string) (*OpcNode, error)
func (*OPCNodeVarsDFT) GetValueByName ¶
func (s *OPCNodeVarsDFT) GetValueByName(name string) (interface{}, error)
func (*OPCNodeVarsDFT) Save ¶
func (s *OPCNodeVarsDFT) Save() error
type Rule ¶
type Rule struct { Type string `json:"type" form:"type" validate:"required" binding:"required,oneof=eq ne gt lt all-time in not-in" example:"eq"` // 规则类型 eq, ne, gt, lt, all-time, in, not-in: 相等, 不相等, 大于, 小于, 全时间, 包含, 不包含 NodeName *string `json:"node_name" form:"node_name" example:"MyVariable"` // 节点名称 Value interface{} `json:"value" form:"value"` // 规则value }
type WebHookConditions ¶
type WebHookConditions struct { Webhooks map[int64]*WebHookConfig `json:"webhooks"` // 0:webhook1, 1:webhook2, 2:webhook3 注意,这里的1,2,3并不是webhook的id,而是condition的id,或者说切片id ConditionList []*Condition `json:"conditions"` IndexConditionId2WebHookId map[int64]int64 `json:"index_condition_id_2_web_hook_id"` // find webhook by condition id }
func NewWebHookConditions ¶
func NewWebHookConditions() *WebHookConditions
func (*WebHookConditions) AddWebHookConfig ¶
func (w *WebHookConditions) AddWebHookConfig(webhook *WebHookConfig)
加载webhook配置到内存,用于判断webhook,所以只会添加有效和激活的webhook
func (*WebHookConditions) FindWebHookByConditionId ¶
func (w *WebHookConditions) FindWebHookByConditionId(conditionId int64) *WebHookConfig
func (*WebHookConditions) RemoveWebHookConfig ¶
func (w *WebHookConditions) RemoveWebHookConfig(webhookId int64)
type WebHookConfig ¶
type WebHookConfig struct { Id int64 `json:"id" form:"id" validate:"required"` Name string `json:"name" form:"name" validate:"required"` Url string `json:"url" form:"url" validate:"required"` Active bool `json:"active" form:"active" validate:"required"` When *Condition `json:"when" form:"when" validate:"omitempty"` ConditionId *int64 `json:"condition_id" form:"condition_id" validate:"omitempty"` NeedNodeNameList []string `validate:"required"` }
func GetAllWebHookConfig ¶
func GetAllWebHookConfig() ([]*WebHookConfig, error)
func (*WebHookConfig) SendMsg ¶
func (wc *WebHookConfig) SendMsg()
Click to show internal directories.
Click to hide internal directories.