msg.go 3.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128
  1. package model
  2. import "encoding/json"
  3. //Msg for databus.
  4. type Msg struct {
  5. MID int64 `json:"mid"`
  6. From int `json:"from"`
  7. IsAuthor int `json:"is_author"`
  8. TimeStamp int64 `json:"timestamp"`
  9. }
  10. // CanalMsg canal databus msg.
  11. type CanalMsg struct {
  12. Action string `json:"action"`
  13. Table string `json:"table"`
  14. New json.RawMessage `json:"new"`
  15. Old json.RawMessage `json:"old"`
  16. }
  17. //TaskMsg for task notify.
  18. type TaskMsg struct {
  19. MID int64 `json:"mid"`
  20. Count int64 `json:"count"`
  21. From int `json:"from"`
  22. TimeStamp int64 `json:"timestamp"`
  23. }
  24. // ShareMsg share databus msg.
  25. type ShareMsg struct {
  26. OID int64 `json:"oid"`
  27. MID int64 `json:"mid"`
  28. TP int `json:"tp"`
  29. Time int64 `json:"time"`
  30. }
  31. // StatLike archive like count
  32. type StatLike struct {
  33. MID int64 `json:"mid"`
  34. Type string `json:"type"`
  35. ID int64 `json:"id"`
  36. Count int64 `json:"count"`
  37. DislikeCount int64 `json:"dislike_count"`
  38. TimeStamp int64 `json:"timestamp"`
  39. }
  40. // StatView ViewMsg archive view count
  41. type StatView struct {
  42. Type string `json:"type"`
  43. ID int64 `json:"id"`
  44. Count int64 `json:"count"`
  45. TimeStamp int64 `json:"timestamp"`
  46. }
  47. // StatDM archive DM count
  48. type StatDM struct {
  49. Type string `json:"type"`
  50. ID int64 `json:"id"`
  51. Count int64 `json:"count"`
  52. TimeStamp int64 `json:"timestamp"`
  53. }
  54. // StatReply archive reply count
  55. type StatReply struct {
  56. Type string `json:"type"`
  57. ID int64 `json:"id"`
  58. Count int64 `json:"count"`
  59. TimeStamp int64 `json:"timestamp"`
  60. }
  61. // StatFav archive collection count
  62. type StatFav struct {
  63. Type string `json:"type"`
  64. ID int64 `json:"id"`
  65. Count int64 `json:"count"`
  66. TimeStamp int64 `json:"timestamp"`
  67. }
  68. // StatCoin archive coin count
  69. type StatCoin struct {
  70. Type string `json:"type"`
  71. ID int64 `json:"id"`
  72. Count int64 `json:"count"`
  73. TimeStamp int64 `json:"timestamp"`
  74. }
  75. // StatShare archive share count
  76. type StatShare struct {
  77. Type string `json:"type"`
  78. ID int64 `json:"id"`
  79. Count int64 `json:"count"`
  80. TimeStamp int64 `json:"timestamp"`
  81. }
  82. // StatRank archive rank
  83. type StatRank struct {
  84. Type string `json:"type"`
  85. ID int64 `json:"id"`
  86. Count int64 `json:"count"`
  87. TimeStamp int64 `json:"timestamp"`
  88. }
  89. // RelaMessage Message define relation binlog databus message.
  90. type RelaMessage struct {
  91. Action string `json:"action"`
  92. Table string `json:"table"`
  93. New json.RawMessage `json:"new"`
  94. Old json.RawMessage `json:"old"`
  95. }
  96. // Relation user_relation_mid_0~user_relation_mid_49
  97. type Relation struct {
  98. MID int64 `json:"mid,omitempty"`
  99. FID int64 `json:"fid,omitempty"`
  100. Attribute uint32 `json:"attribute"`
  101. Status int `json:"status"`
  102. MTime string `json:"mtime"`
  103. CTime string `json:"ctime"`
  104. }
  105. // Stat user_relation_stat
  106. type Stat struct {
  107. MID int64 `json:"mid,omitempty"`
  108. Following int64 `json:"following"`
  109. Whisper int64 `json:"whisper"`
  110. Black int64 `json:"black"`
  111. Follower int64 `json:"follower"`
  112. }