Skip to content

Commit c84d583

Browse files
committed
feat: add sqlite3 database support
1 parent de44adb commit c84d583

File tree

4 files changed

+610
-8
lines changed

4 files changed

+610
-8
lines changed

db/sqlite3/model.go

Lines changed: 72 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,72 @@
1+
package sqlite3
2+
3+
const (
4+
Sqlite3GroupMessageTableName = "grpmsg"
5+
Sqlite3MessageAttributeTableName = "msgattr"
6+
Sqlite3GuildMessageAttributeTableName = "gmsgattr"
7+
Sqlite3QuotedInfoTableName = "quoinf"
8+
Sqlite3PrivateMessageTableName = "privmsg"
9+
Sqlite3GuildChannelMessageTableName = "guildmsg"
10+
)
11+
12+
// StoredMessageAttribute 持久化消息属性
13+
type StoredMessageAttribute struct {
14+
ID int64 // ID is the crc64 of 字段s below
15+
MessageSeq int32
16+
InternalID int32
17+
SenderUin int64
18+
SenderName string
19+
Timestamp int64
20+
}
21+
22+
// StoredGuildMessageAttribute 持久化频道消息属性
23+
type StoredGuildMessageAttribute struct {
24+
ID int64 // ID is the crc64 of 字段s below
25+
MessageSeq int64
26+
InternalID int64
27+
SenderTinyID int64
28+
SenderName string
29+
Timestamp int64
30+
}
31+
32+
// QuotedInfo 引用回复
33+
type QuotedInfo struct {
34+
ID int64 // ID is the crc64 of 字段s below
35+
PrevID string
36+
PrevGlobalID int32
37+
QuotedContent string // QuotedContent is json of original content
38+
}
39+
40+
// StoredGroupMessage 持久化群消息
41+
type StoredGroupMessage struct {
42+
GlobalID int32
43+
ID string
44+
AttributeID int64
45+
SubType string
46+
QuotedInfoID int64
47+
GroupCode int64
48+
AnonymousID string
49+
Content string // Content is json of original content
50+
}
51+
52+
// StoredPrivateMessage 持久化私聊消息
53+
type StoredPrivateMessage struct {
54+
GlobalID int32
55+
ID string
56+
AttributeID int64
57+
SubType string
58+
QuotedInfoID int64
59+
SessionUin int64
60+
TargetUin int64
61+
Content string // Content is json of original content
62+
}
63+
64+
// StoredGuildChannelMessage 持久化频道消息
65+
type StoredGuildChannelMessage struct {
66+
ID string
67+
AttributeID int64
68+
GuildID int64
69+
ChannelID int64
70+
QuotedInfoID int64
71+
Content string // Content is json of original content
72+
}

0 commit comments

Comments
 (0)