Files
servicebase/pkg/partner/mq/message/message_event.go
2025-11-19 14:24:13 +08:00

36 lines
766 B
Go
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

package message
import (
"encoding/json"
)
// 事件
type EventMessage struct {
Message
Tag EventTag // 消息标签EventTagUser=用户
Flag EventFlag // 消息标签EventFlagCreate=创建 EventFlagUpdate=更新 EventFlagSave=创建或更新 EventFlagDelete=删除
EventId string // 事件ID
EventContent any // 事件内容
}
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)
}