Documentation
¶
Index ¶
- Constants
- func IsPollNotFound(err error) bool
- type Button
- type CallEvent
- type CallParticipant
- type Chat
- type ChatListFilter
- type Contact
- type DB
- func (d *DB) AddTag(jid, tag string) error
- func (d *DB) ClearAllSystemNames() (int64, error)
- func (d *DB) Close() error
- func (d *DB) CountChatMessages(jid string) (int64, error)
- func (d *DB) CountChats() (int64, error)
- func (d *DB) CountGroups() (int64, error)
- func (d *DB) CountLeftGroups() (int64, error)
- func (d *DB) CountMessages() (int64, error)
- func (d *DB) CountSystemNames() (int64, error)
- func (d *DB) DeleteCallEvents(p DeleteCallEventsParams) (int64, error)
- func (d *DB) DeleteChat(jid string) error
- func (d *DB) DeleteChatsOlderThan(days int) (int64, error)
- func (d *DB) DeleteGroup(jid string) error
- func (d *DB) DeleteGroupLocalData(jid string) (err error)
- func (d *DB) DeleteLeftGroups() (int64, error)
- func (d *DB) DeleteLeftGroupsOlderThan(days int) (int64, error)
- func (d *DB) DeletePoll(chatJID, msgID string) error
- func (d *DB) DeletePollVote(chatJID, pollMsgID, voterJID string, votedAt time.Time) error
- func (d *DB) FindPollByMsgID(msgID string) (Poll, error)
- func (d *DB) GetChat(jid string) (Chat, error)
- func (d *DB) GetContact(jid string) (Contact, error)
- func (d *DB) GetLatestMessageInfo(chatJID string) (MessageInfo, error)
- func (d *DB) GetMediaDownloadInfo(chatJID, msgID string) (MediaDownloadInfo, error)
- func (d *DB) GetMessage(chatJID, msgID string) (Message, error)
- func (d *DB) GetOldestMessageInfo(chatJID string) (MessageInfo, error)
- func (d *DB) GetPoll(chatJID, msgID string) (Poll, error)
- func (d *DB) GetStatusMessage(msgID string) (StatusMessage, error)
- func (d *DB) HasFTS() bool
- func (d *DB) HistoricalLIDJIDs() ([]string, error)
- func (d *DB) IncrementChatUnread(jid string) error
- func (d *DB) ListCallEvents(p ListCallEventsParams) ([]CallEvent, error)
- func (d *DB) ListChats(query string, limit int) ([]Chat, error)
- func (d *DB) ListChatsFiltered(f ChatListFilter) ([]Chat, error)
- func (d *DB) ListChatsOlderThan(days int) ([]Chat, error)
- func (d *DB) ListContacts(limit int) ([]Contact, error)
- func (d *DB) ListGroups(query string, limit int) ([]Group, error)
- func (d *DB) ListHistoryCoverage(p ListHistoryCoverageParams) ([]HistoryCoverage, error)
- func (d *DB) ListLeftGroups() ([]Group, error)
- func (d *DB) ListMessages(p ListMessagesParams) ([]Message, error)
- func (d *DB) ListPollVotes(chatJID, pollMsgID string) ([]PollVote, error)
- func (d *DB) ListPolls(filter PollListFilter) ([]Poll, error)
- func (d *DB) ListPrunableGroups(days int, includeActive bool) ([]Group, error)
- func (d *DB) ListStarredMessages(p ListStarredMessagesParams) ([]Message, error)
- func (d *DB) ListTags(jid string) ([]string, error)
- func (d *DB) MarkGroupLeft(jid string, leftAt time.Time) error
- func (d *DB) MarkGroupsMissingFrom(joined map[string]bool, leftAt time.Time) error
- func (d *DB) MarkMediaDownloaded(chatJID, msgID, localPath string, downloadedAt time.Time) error
- func (d *DB) MarkMessageDeletedForMe(chatJID, msgID, senderJID string, fromMe bool, deletedAt time.Time) error
- func (d *DB) MarkMessageDeletedForMePreserveMedia(chatJID, msgID string) error
- func (d *DB) MarkMessageRevoked(chatJID, msgID string) error
- func (d *DB) MessageContext(chatJID, msgID string, before, after int) ([]Message, error)
- func (d *DB) MigrateLIDToPN(lidJID, pnJID string) error
- func (d *DB) RemoveAlias(jid string) error
- func (d *DB) RemoveTag(jid, tag string) error
- func (d *DB) ReplaceGroupParticipants(groupJID string, participants []GroupParticipant) (err error)
- func (d *DB) SearchContacts(query string, limit int) ([]Contact, error)
- func (d *DB) SearchMessages(p SearchMessagesParams) ([]Message, error)
- func (d *DB) SetAlias(jid, alias string) error
- func (d *DB) SetChatArchived(jid string, archived bool) error
- func (d *DB) SetChatMutedUntil(jid string, mutedUntil int64) error
- func (d *DB) SetChatPinned(jid string, pinned bool) error
- func (d *DB) SetChatUnread(jid string, unread bool) error
- func (d *DB) SetChatUnreadCount(jid string, count int) error
- func (d *DB) SetStarred(p SetStarredParams) error
- func (d *DB) SetSystemName(jid, systemName string) error
- func (d *DB) Stats() (StoreStats, error)
- func (d *DB) UpdateMessageText(chatJID, msgID, text string) error
- func (d *DB) UpsertCallEvent(p UpsertCallEventParams) error
- func (d *DB) UpsertChat(jid, kind, name string, lastTS time.Time) error
- func (d *DB) UpsertContact(jid, phone, pushName, fullName, firstName, businessName string) error
- func (d *DB) UpsertGroup(jid, name, ownerJID string, created time.Time) error
- func (d *DB) UpsertGroupWithHierarchy(jid, name, ownerJID string, created time.Time, isParent bool, ...) error
- func (d *DB) UpsertMessage(p UpsertMessageParams) error
- func (d *DB) UpsertPoll(p Poll) error
- func (d *DB) UpsertPollVote(v PollVote) error
- func (d *DB) UpsertStatusMessage(p UpsertStatusMessageParams) error
- type DeleteCallEventsParams
- type Group
- type GroupParticipant
- type HistoryCoverage
- type ListCallEventsParams
- type ListHistoryCoverageParams
- type ListMessagesParams
- type ListStarredMessagesParams
- type MediaDownloadInfo
- type Message
- type MessageInfo
- type Poll
- type PollListFilter
- type PollVote
- type SearchMessagesParams
- type SetStarredParams
- type StatusMessage
- type StoreStats
- type UpsertCallEventParams
- type UpsertMessageParams
- type UpsertStatusMessageParams
Constants ¶
const ( HistoryCoverageStatusReady = "ready" HistoryCoverageStatusBlocked = "blocked" HistoryCoverageBlockedNoAnchor = "no_local_anchor" )
const DeletedForMeMessageDisplayText = "This message was deleted for me"
const DeletedMessageDisplayText = "This message was deleted"
Variables ¶
This section is empty.
Functions ¶
func IsPollNotFound ¶ added in v0.9.0
IsPollNotFound is a small convenience predicate.
Types ¶
type Button ¶ added in v0.9.0
type Button struct {
Type string `json:"type"`
DisplayText string `json:"display_text"`
ID string `json:"id,omitempty"`
URL string `json:"url,omitempty"`
PhoneNumber string `json:"phone_number,omitempty"`
Description string `json:"description,omitempty"`
ResponseType string `json:"response_type,omitempty"`
Index int `json:"index,omitempty"`
}
type CallEvent ¶ added in v0.9.2
type CallEvent struct {
ChatJID string `json:"chat_jid"`
ChatName string `json:"chat_name,omitempty"`
SenderJID string `json:"sender_jid,omitempty"`
SenderName string `json:"sender_name,omitempty"`
CallID string `json:"call_id"`
MsgID string `json:"msg_id,omitempty"`
EventType string `json:"event_type"`
Direction string `json:"direction,omitempty"`
Media string `json:"media,omitempty"`
Outcome string `json:"outcome,omitempty"`
Reason string `json:"reason,omitempty"`
CallType string `json:"call_type,omitempty"`
DurationSecs int64 `json:"duration_secs,omitempty"`
Timestamp time.Time `json:"timestamp"`
Participants []CallParticipant `json:"participants,omitempty"`
// contains filtered or unexported fields
}
type CallParticipant ¶ added in v0.9.2
type Chat ¶
type Chat struct {
JID string `json:"jid"`
Kind string `json:"kind"`
Name string `json:"name"`
LastMessageTS time.Time `json:"last_message_ts"`
Archived bool `json:"archived"`
Pinned bool `json:"pinned"`
MutedUntil int64 `json:"muted_until"`
Unread bool `json:"unread"`
UnreadCount int `json:"unread_count"`
}
type ChatListFilter ¶
type DB ¶
type DB struct {
// contains filtered or unexported fields
}
func OpenReadOnly ¶ added in v0.9.2
func (*DB) ClearAllSystemNames ¶
func (*DB) CountChats ¶ added in v0.9.2
func (*DB) CountGroups ¶ added in v0.9.2
func (*DB) CountLeftGroups ¶ added in v0.9.2
func (*DB) CountMessages ¶
func (*DB) CountSystemNames ¶
func (*DB) DeleteCallEvents ¶ added in v0.9.2
func (d *DB) DeleteCallEvents(p DeleteCallEventsParams) (int64, error)
func (*DB) DeleteChat ¶
func (*DB) DeleteGroup ¶
func (*DB) DeleteGroupLocalData ¶
func (*DB) DeleteLeftGroups ¶
func (*DB) DeleteLeftGroupsOlderThan ¶
func (*DB) DeletePoll ¶ added in v0.9.0
DeletePoll removes a poll and all its votes (votes are cascaded by foreign key, but we issue an explicit delete since the FK isn't declared at the table level).
func (*DB) DeletePollVote ¶ added in v0.9.0
DeletePollVote removes one voter's current vote if the deletion is not older than the stored vote row.
func (*DB) FindPollByMsgID ¶ added in v0.9.0
FindPollByMsgID returns the most recent poll matching the given msg_id across any chat. Useful when the chat JID embedded in a vote event (often a LID) does not match the chat under which the poll was stored (often a phone-number JID for self-conversations). Returns sql.ErrNoRows if not found.
func (*DB) GetLatestMessageInfo ¶
func (d *DB) GetLatestMessageInfo(chatJID string) (MessageInfo, error)
func (*DB) GetMediaDownloadInfo ¶
func (d *DB) GetMediaDownloadInfo(chatJID, msgID string) (MediaDownloadInfo, error)
func (*DB) GetOldestMessageInfo ¶
func (d *DB) GetOldestMessageInfo(chatJID string) (MessageInfo, error)
func (*DB) GetPoll ¶ added in v0.9.0
GetPoll fetches a single poll by (chat_jid, msg_id). Returns sql.ErrNoRows if not found.
func (*DB) GetStatusMessage ¶ added in v0.9.2
func (d *DB) GetStatusMessage(msgID string) (StatusMessage, error)
func (*DB) HistoricalLIDJIDs ¶
HistoricalLIDJIDs returns distinct hidden-user JIDs stored in chat and message/poll identity columns. The app layer resolves these through whatsmeow.
func (*DB) IncrementChatUnread ¶ added in v0.11.0
func (*DB) ListCallEvents ¶ added in v0.9.2
func (d *DB) ListCallEvents(p ListCallEventsParams) ([]CallEvent, error)
func (*DB) ListChatsFiltered ¶
func (d *DB) ListChatsFiltered(f ChatListFilter) ([]Chat, error)
func (*DB) ListHistoryCoverage ¶
func (d *DB) ListHistoryCoverage(p ListHistoryCoverageParams) ([]HistoryCoverage, error)
func (*DB) ListLeftGroups ¶
func (*DB) ListMessages ¶
func (d *DB) ListMessages(p ListMessagesParams) ([]Message, error)
func (*DB) ListPollVotes ¶ added in v0.9.0
ListPollVotes returns the per-voter votes for a poll, ordered by ts ASC.
func (*DB) ListPolls ¶ added in v0.9.0
func (d *DB) ListPolls(filter PollListFilter) ([]Poll, error)
ListPolls returns polls ordered most-recent-first.
func (*DB) ListPrunableGroups ¶
func (*DB) ListStarredMessages ¶
func (d *DB) ListStarredMessages(p ListStarredMessagesParams) ([]Message, error)
func (*DB) MarkGroupsMissingFrom ¶
func (*DB) MarkMediaDownloaded ¶
func (*DB) MarkMessageDeletedForMe ¶
func (*DB) MarkMessageDeletedForMePreserveMedia ¶ added in v0.9.2
func (*DB) MarkMessageRevoked ¶
func (*DB) MessageContext ¶
func (*DB) MigrateLIDToPN ¶
MigrateLIDToPN rewrites one historical hidden-user JID to its phone-number JID. It is idempotent and merges duplicate chat/message rows created by the old split storage behavior.
func (*DB) RemoveAlias ¶
func (*DB) ReplaceGroupParticipants ¶
func (d *DB) ReplaceGroupParticipants(groupJID string, participants []GroupParticipant) (err error)
func (*DB) SearchMessages ¶
func (d *DB) SearchMessages(p SearchMessagesParams) ([]Message, error)
func (*DB) SetChatUnreadCount ¶ added in v0.11.0
func (*DB) SetStarred ¶
func (d *DB) SetStarred(p SetStarredParams) error
func (*DB) SetSystemName ¶
func (*DB) Stats ¶
func (d *DB) Stats() (StoreStats, error)
func (*DB) UpdateMessageText ¶
func (*DB) UpsertCallEvent ¶ added in v0.9.2
func (d *DB) UpsertCallEvent(p UpsertCallEventParams) error
func (*DB) UpsertContact ¶
func (*DB) UpsertGroup ¶
func (*DB) UpsertGroupWithHierarchy ¶
func (*DB) UpsertMessage ¶
func (d *DB) UpsertMessage(p UpsertMessageParams) error
func (*DB) UpsertPoll ¶ added in v0.9.0
UpsertPoll inserts or replaces a poll row keyed on (chat_jid, msg_id).
func (*DB) UpsertPollVote ¶ added in v0.9.0
UpsertPollVote replaces the vote row for (chat, poll, voter).
func (*DB) UpsertStatusMessage ¶ added in v0.9.2
func (d *DB) UpsertStatusMessage(p UpsertStatusMessageParams) error
type DeleteCallEventsParams ¶ added in v0.9.2
type GroupParticipant ¶
type HistoryCoverage ¶
type HistoryCoverage struct {
ChatJID string `json:"chat_jid"`
Kind string `json:"kind"`
Name string `json:"name,omitempty"`
LastMessageTS time.Time `json:"last_message_ts,omitempty"`
MessageCount int64 `json:"message_count"`
OldestTS time.Time `json:"oldest_ts,omitempty"`
NewestTS time.Time `json:"newest_ts,omitempty"`
Status string `json:"status"`
BlockedReason string `json:"blocked_reason,omitempty"`
}
type ListCallEventsParams ¶ added in v0.9.2
type ListMessagesParams ¶
type MediaDownloadInfo ¶
type Message ¶
type Message struct {
ChatJID string
ChatName string
MsgID string
SenderJID string
SenderName string
Timestamp time.Time
FromMe bool
Text string
DisplayText string
QuotedMsgID string `json:"quoted_msg_id,omitempty"`
QuotedSenderJID string `json:"quoted_sender_jid,omitempty"`
Buttons []Button `json:",omitempty"`
IsForwarded bool
ForwardingScore uint32
ReactionToID string
ReactionEmoji string
MediaType string
MediaCaption string
Filename string
MimeType string
DirectPath string
LocalPath string
DownloadedAt time.Time
Starred bool
StarredAt time.Time
Revoked bool
DeletedForMe bool
Snippet string
// contains filtered or unexported fields
}
type MessageInfo ¶
type Poll ¶ added in v0.9.0
type Poll struct {
ChatJID string
MsgID string
SenderJID string
Question string
Options []string
SelectableCount uint32
CreatedAt time.Time
}
Poll represents a stored PollCreationMessage.
type PollListFilter ¶ added in v0.9.0
PollListFilter narrows down polls returned by ListPolls.
type PollVote ¶ added in v0.9.0
type PollVote struct {
ChatJID string
PollMsgID string
VoterJID string
VoteMsgID string
Selected []string
UnknownHashes []string
VotedAt time.Time
}
PollVote represents one voter's latest vote on a poll.
type SearchMessagesParams ¶
type SetStarredParams ¶
type StatusMessage ¶ added in v0.9.2
type StatusMessage struct {
RowID int64
MsgID string
Timestamp time.Time
FromMe bool
SenderJID string
SenderName string
Text string
MediaType string
MediaCaption string
Filename string
MimeType string
DirectPath string
MediaKey []byte
FileSHA256 []byte
FileEncSHA256 []byte
FileLength uint64
BackgroundColor string
Font int32
}
type StoreStats ¶
type UpsertCallEventParams ¶ added in v0.9.2
type UpsertMessageParams ¶
type UpsertMessageParams struct {
ChatJID string
ChatName string
MsgID string
SenderJID string
SenderName string
Timestamp time.Time
FromMe bool
Text string
DisplayText string
QuotedMsgID string
QuotedSenderJID string
Buttons []Button
IsForwarded bool
ForwardingScore uint32
ReactionToID string
ReactionEmoji string
MediaType string
MediaCaption string
Filename string
MimeType string
DirectPath string
MediaKey []byte
FileSHA256 []byte
FileEncSHA256 []byte
FileLength uint64
Edited bool
Revoked bool
DeletedForMe bool
}
type UpsertStatusMessageParams ¶ added in v0.9.2
type UpsertStatusMessageParams struct {
MsgID string
Timestamp time.Time
FromMe bool
SenderJID string
SenderName string
Text string
MediaType string
MediaCaption string
Filename string
MimeType string
DirectPath string
MediaKey []byte
FileSHA256 []byte
FileEncSHA256 []byte
FileLength uint64
BackgroundColor string
Font int32
}