Skip to content

Commit f213796

Browse files
authored
Merge pull request #12 from go-goim/feature/update-message-pb
feat: update message pb
2 parents 0b1084c + a7abf68 commit f213796

File tree

6 files changed

+1035
-119
lines changed

6 files changed

+1035
-119
lines changed

message/v1/message.ext.go

+32
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
package v1
2+
3+
import (
4+
"strconv"
5+
)
6+
7+
// This file is for extend proto generated structs methods.
8+
9+
func (x *StorageMessage) HbaseRowKey() string {
10+
return x.RowKey
11+
}
12+
13+
func (x *StorageMessage) HbaseValues() map[string]map[string][]byte {
14+
return map[string]map[string][]byte{
15+
"users": {
16+
"from": []byte(strconv.FormatInt(x.Users.FromID, 10)),
17+
"to": []byte(strconv.FormatInt(x.Users.ToID, 10)),
18+
"sessionId": []byte(x.Users.SessionID),
19+
},
20+
"content": {
21+
"type": []byte(strconv.Itoa(int(x.Content.ContentType))),
22+
"text": []byte(x.Content.Content), // TODO: use content instead of text
23+
},
24+
"extra": {
25+
"timestamp": []byte(strconv.FormatInt(x.Extra.CreateTime.Seconds, 10)),
26+
},
27+
}
28+
}
29+
30+
func (x *StorageMessage) TableName() string {
31+
return "message_history"
32+
}

0 commit comments

Comments
 (0)