-
Notifications
You must be signed in to change notification settings - Fork 38
/
Copy pathchat_message_importance.go
39 lines (37 loc) · 1.11 KB
/
chat_message_importance.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
35
36
37
38
39
package models
type ChatMessageImportance int
const (
NORMAL_CHATMESSAGEIMPORTANCE ChatMessageImportance = iota
HIGH_CHATMESSAGEIMPORTANCE
URGENT_CHATMESSAGEIMPORTANCE
UNKNOWNFUTUREVALUE_CHATMESSAGEIMPORTANCE
)
func (i ChatMessageImportance) String() string {
return []string{"normal", "high", "urgent", "unknownFutureValue"}[i]
}
func ParseChatMessageImportance(v string) (any, error) {
result := NORMAL_CHATMESSAGEIMPORTANCE
switch v {
case "normal":
result = NORMAL_CHATMESSAGEIMPORTANCE
case "high":
result = HIGH_CHATMESSAGEIMPORTANCE
case "urgent":
result = URGENT_CHATMESSAGEIMPORTANCE
case "unknownFutureValue":
result = UNKNOWNFUTUREVALUE_CHATMESSAGEIMPORTANCE
default:
return nil, nil
}
return &result, nil
}
func SerializeChatMessageImportance(values []ChatMessageImportance) []string {
result := make([]string, len(values))
for i, v := range values {
result[i] = v.String()
}
return result
}
func (i ChatMessageImportance) isMultiValue() bool {
return false
}