first commit
This commit is contained in:
35
pkg/partner/mq/message/message_event.go
Normal file
35
pkg/partner/mq/message/message_event.go
Normal file
@ -0,0 +1,35 @@
|
||||
package message
|
||||
|
||||
import (
|
||||
"encoding/json"
|
||||
)
|
||||
|
||||
// 事件
|
||||
type EventMessage struct {
|
||||
Message
|
||||
Tag EventTag // 消息标签:EventTagUser=用户
|
||||
Flag EventFlag // 消息标签:EventFlagCreate=创建 EventFlagUpdate=更新 EventFlagSave=创建或更新 EventFlagDelete=删除
|
||||
EventId string // 事件ID
|
||||
EventContent interface{} // 事件内容
|
||||
}
|
||||
|
||||
type EventTag string
|
||||
|
||||
const (
|
||||
EventTagUser = "user"
|
||||
EventTagRoomInto EventTag = "into_room"
|
||||
)
|
||||
|
||||
type EventFlag string
|
||||
|
||||
const (
|
||||
EventFlagSave EventFlag = "save"
|
||||
EventFlagCreate EventFlag = "create"
|
||||
EventFlagUpdate EventFlag = "update"
|
||||
EventFlagDelete EventFlag = "delete"
|
||||
)
|
||||
|
||||
func (message *EventMessage) ToJson() string {
|
||||
b, _ := json.Marshal(message)
|
||||
return string(b)
|
||||
}
|
||||
Reference in New Issue
Block a user