wechatdb

package
v0.0.1 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Mar 19, 2025 License: Apache-2.0 Imports: 10 Imported by: 0

Documentation

Index

Constants

View Source
const (
	MessageFileV3 = "^MSG([0-9]?[0-9])?\\.db$"
	MessageFileV4 = "^messages_([0-9]?[0-9])+\\.db$"
)

Variables

View Source
var (
	ContactFileV3 = "^MicroMsg.db$"
	ContactFileV4 = "contact.db$"
)

Functions

This section is empty.

Types

type Contact

type Contact struct {
	Contact  map[string]*model.Contact  // 好友和群聊信息,Key UserName
	ChatRoom map[string]*model.ChatRoom // 群聊信息,Key UserName
	Sessions []*model.Session           // 历史会话,按时间倒序

	// Quick Search
	ChatRoomUsers    map[string]*model.Contact // 群聊成员信息,Key UserName
	Alias2Contack    map[string]*model.Contact // 别名到联系人的映射
	Remark2Contack   map[string]*model.Contact // 备注名到联系人的映射
	NickName2Contack map[string]*model.Contact // 昵称到联系人的映射
	// contains filtered or unexported fields
}

func NewContact

func NewContact(path string, version int) (*Contact, error)

func (*Contact) GetChatRoom

func (c *Contact) GetChatRoom(name string) *model.ChatRoom

func (*Contact) GetContact

func (c *Contact) GetContact(key string) *model.Contact

func (*Contact) GetSession

func (c *Contact) GetSession(limit int) []*model.Session

func (*Contact) ListChatRoom

func (c *Contact) ListChatRoom() ([]*model.ChatRoom, error)

func (*Contact) ListContact

func (c *Contact) ListContact() ([]*model.Contact, error)

func (*Contact) MessageFillInfo

func (c *Contact) MessageFillInfo(msg *model.Message)

type DB

type DB struct {
	BasePath string
	Version  int
	// contains filtered or unexported fields
}

func New

func New(path string, version int) (*DB, error)

func (*DB) Close

func (w *DB) Close() error

func (*DB) GetChatRoom

func (w *DB) GetChatRoom(userName string) *model.ChatRoom

func (*DB) GetContact

func (w *DB) GetContact(userName string) *model.Contact

func (*DB) GetMessages

func (w *DB) GetMessages(start, end time.Time, talker string, limit, offset int) ([]*model.Message, error)

func (*DB) GetSession

func (w *DB) GetSession(limit int) (*GetSessionResp, error)

func (*DB) Initialize

func (w *DB) Initialize() error

func (*DB) ListChatRoom

func (w *DB) ListChatRoom() (*ListChatRoomResp, error)

func (*DB) ListContact

func (w *DB) ListContact() (*ListContactResp, error)

type GetSessionResp

type GetSessionResp struct {
	Items []*model.Session `json:"items"`
}

type ListChatRoomResp

type ListChatRoomResp struct {
	Items []*model.ChatRoom `json:"items"`
}

type ListContactResp

type ListContactResp struct {
	Items []*model.Contact `json:"items"`
}

type Message

type Message struct {
	// contains filtered or unexported fields
}

func NewMessage

func NewMessage(path string, version int) (*Message, error)

func (*Message) GetMessages

func (m *Message) GetMessages(startTime, endTime time.Time, talker string, limit, offset int) ([]*model.Message, error)

GetMessages 根据时间段和 talker 查询聊天记录

type MsgDBInfo

type MsgDBInfo struct {
	FilePath  string
	StartTime time.Time
	EndTime   time.Time
	TalkerMap map[string]int
}

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL