entities.go 726 B

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556
  1. package entities
  2. type EntityId interface {
  3. GetId() string
  4. GetEntityType() EntityType
  5. }
  6. type EntityType int
  7. const (
  8. TENANT EntityType = iota
  9. DEVICE
  10. ALARM
  11. RULE_CHAIN
  12. RULE_NODE
  13. )
  14. func (a EntityType) String() string {
  15. switch a {
  16. case 0:
  17. return "TENANT"
  18. case 1:
  19. return "DEVICE"
  20. case 2:
  21. return "ALARM"
  22. case 3:
  23. return "RULE_CHAIN"
  24. case 4:
  25. return "RULE_NODE"
  26. }
  27. return ""
  28. }
  29. type RuleNodeId struct {
  30. Id string
  31. }
  32. func (r *RuleNodeId) GetId() string {
  33. return r.Id
  34. }
  35. func (r *RuleNodeId) GetEntityType() EntityType {
  36. return RULE_NODE
  37. }
  38. type RuleChainId struct {
  39. Id string
  40. }
  41. func (r *RuleChainId) GetId() string {
  42. return r.Id
  43. }
  44. func (r *RuleChainId) GetEntityType() EntityType {
  45. return RULE_CHAIN
  46. }