store

package
v0.1.0 Latest Latest
Warning

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

Go to latest
Published: Mar 6, 2026 License: AGPL-3.0 Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func IsNotFound

func IsNotFound(err error) bool

Types

type Chat

type Chat struct {
	PeerID        string    `json:"peer_id"`
	Kind          string    `json:"kind"` // private, group, channel
	Name          string    `json:"name"`
	LastMessageTS time.Time `json:"last_message_ts"`
}

type DB

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

func Open

func Open(path string) (*DB, error)

func (*DB) Close

func (d *DB) Close() error

func (*DB) CountChats

func (d *DB) CountChats() (int64, error)

func (*DB) CountMessages

func (d *DB) CountMessages() (int64, error)

func (*DB) GetChat

func (d *DB) GetChat(peerID string) (Chat, error)

func (*DB) GetMessage

func (d *DB) GetMessage(chatID string, msgID int) (Message, error)

func (*DB) HasFTS

func (d *DB) HasFTS() bool

func (*DB) ListChats

func (d *DB) ListChats(kind string, limit int) ([]Chat, error)

func (*DB) ListMessages

func (d *DB) ListMessages(p ListMessagesParams) ([]Message, error)

func (*DB) MessageContext

func (d *DB) MessageContext(chatID string, msgID int, before, after int) ([]Message, error)

func (*DB) SearchMessages

func (d *DB) SearchMessages(p SearchMessagesParams) ([]Message, error)

func (*DB) UpdateMessageLocalPath

func (d *DB) UpdateMessageLocalPath(chatID string, msgID int, localPath string) error

func (*DB) UpsertChat

func (d *DB) UpsertChat(peerID, kind, name string, lastMsgTS time.Time) error

func (*DB) UpsertMessage

func (d *DB) UpsertMessage(p UpsertMessageParams) error

type ListMessagesParams

type ListMessagesParams struct {
	ChatID string
	Limit  int
	Before *time.Time
	After  *time.Time
}

type Message

type Message struct {
	ChatID     string    `json:"chat_id"`
	ChatName   string    `json:"chat_name"`
	MsgID      int       `json:"msg_id"`
	SenderID   string    `json:"sender_id"`
	SenderName string    `json:"sender_name"`
	Timestamp  time.Time `json:"timestamp"`
	FromMe     bool      `json:"from_me"`
	Text       string    `json:"text"`
	MediaType  string    `json:"media_type,omitempty"`
	Snippet    string    `json:"snippet,omitempty"`
}

type SearchMessagesParams

type SearchMessagesParams struct {
	Query  string
	ChatID string
	Limit  int
}

type UpsertMessageParams

type UpsertMessageParams struct {
	ChatID       string
	ChatName     string
	MsgID        int
	SenderID     string
	SenderName   string
	Timestamp    time.Time
	FromMe       bool
	Text         string
	MediaType    string
	MediaCaption string
	Filename     string
	MimeType     string
	FileID       string
	FileSize     int64
}

Jump to

Keyboard shortcuts

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