Files
chatlog/internal/model/session_v4.go
Shen Junzheng 80c7e67106 x
2025-03-24 22:42:31 +08:00

55 lines
1.8 KiB
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 model
import "time"
// 注意v4 session 是独立数据库文件
// CREATE TABLE SessionTable(
// username TEXT PRIMARY KEY,
// type INTEGER,
// unread_count INTEGER,
// unread_first_msg_srv_id INTEGER,
// is_hidden INTEGER,
// summary TEXT,
// draft TEXT,
// status INTEGER,
// last_timestamp INTEGER,
// sort_timestamp INTEGER,
// last_clear_unread_timestamp INTEGER,
// last_msg_locald_id INTEGER,
// last_msg_type INTEGER,
// last_msg_sub_type INTEGER,
// last_msg_sender TEXT,
// last_sender_display_name TEXT,
// last_msg_ext_type INTEGER
// )
type SessionV4 struct {
Username string `json:"username"`
Summary string `json:"summary"`
LastTimestamp int `json:"last_timestamp"`
LastMsgSender string `json:"last_msg_sender"`
LastSenderDisplayName string `json:"last_sender_display_name"`
// Type int `json:"type"`
// UnreadCount int `json:"unread_count"`
// UnreadFirstMsgSrvID int `json:"unread_first_msg_srv_id"`
// IsHidden int `json:"is_hidden"`
// Draft string `json:"draft"`
// Status int `json:"status"`
// SortTimestamp int `json:"sort_timestamp"`
// LastClearUnreadTimestamp int `json:"last_clear_unread_timestamp"`
// LastMsgLocaldID int `json:"last_msg_locald_id"`
// LastMsgType int `json:"last_msg_type"`
// LastMsgSubType int `json:"last_msg_sub_type"`
// LastMsgExtType int `json:"last_msg_ext_type"`
}
func (s *SessionV4) Wrap() *Session {
return &Session{
UserName: s.Username,
NOrder: s.LastTimestamp,
NickName: s.LastSenderDisplayName,
Content: s.Summary,
NTime: time.Unix(int64(s.LastTimestamp), 0),
}
}