-
Notifications
You must be signed in to change notification settings - Fork 0
/
message.go
34 lines (28 loc) · 1.16 KB
/
message.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
package entity
import "time"
type MessageContentType string
type MessageReceiverType string
var (
MessageContentText MessageContentType = "message.content.text"
MessageContentEvent MessageContentType = "message.content.event"
MessageContentImage MessageContentType = "message.content.image"
MessageReceiverUser MessageReceiverType = "message.receiver.user"
MessageReceiverDiscussion MessageReceiverType = "message.receiver.discussion"
)
type Message struct {
ID interface{} `json:"id"`
ContentType MessageContentType `json:"content_type"`
Content string `json:"content"`
ReceiverType MessageReceiverType `json:"receiver_type"`
ReceiverID interface{} `json:"receiver_id"`
Sender User `json:"sender"`
CreatedAt time.Time `json:"created_at"`
}
type CreateMessage struct {
ContentType MessageContentType `json:"content_type"`
Content string `json:"content"`
ReceiverType MessageReceiverType `json:"receiver_type"`
ReceiverID interface{} `json:"receiver_id"`
Sender User `json:"-"`
CreatedAt time.Time `json:"-"`
}