schema.go 1.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657
  1. package protocol
  2. import "fmt"
  3. // RelationType 默认节点关系
  4. type RelationType string
  5. type RelationTypes []RelationType
  6. func (a RelationType) String() string {
  7. return string(a)
  8. }
  9. func (a RelationTypes) ToStrArray() []string {
  10. var str []string
  11. for _, item := range a {
  12. str = append(str, item.String())
  13. }
  14. return str
  15. }
  16. const (
  17. Success RelationType = "Success" // 成功
  18. Failure RelationType = "Failure" // 失败
  19. Other RelationType = "Other" // 其他
  20. True RelationType = "True" // 真
  21. False RelationType = "False" // 假
  22. PostAttributes RelationType = "Post attributes" // 上报属性
  23. PostEvent RelationType = "Post Event" // 上报事件
  24. ConnectEvent RelationType = "Connect Event" // 接入
  25. DisconnectEvent RelationType = "Disconnect Event" // 断开
  26. )
  27. const (
  28. POST_ATTRIBUTES_REQUEST = "POST_ATTRIBUTES_REQUEST" // 属性上报消息
  29. POST_EVENT_REQUEST = "POST_EVENT_REQUEST" // 事件上报消息
  30. CONNECT_EVENT = "CONNECT_EVENT" // 接入事件
  31. DISCONNECT_EVENT = "DISCONNECT_EVENT" // 断开事件
  32. )
  33. // RuleNodeInfo rule node info for output
  34. type RuleNodeInfo struct {
  35. RuleNodeId string
  36. RuleChainName string
  37. RuleNodeName string
  38. }
  39. func (r *RuleNodeInfo) String() string {
  40. return fmt.Sprintf("[RuleChain:%s|RuleNode:%s|RuleNodeId:%s]", r.RuleChainName, r.RuleNodeName, r.RuleNodeId)
  41. }
  42. type RuleNodeRelation struct {
  43. In string
  44. Out string
  45. RelationType RelationType
  46. }