wadb

package
v0.11.0 Latest Latest
Warning

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

Go to latest
Published: Oct 16, 2024 License: AGPL-3.0 Imports: 17 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Conversation

type Conversation struct {
	BridgeID                  networkid.BridgeID
	UserLoginID               networkid.UserLoginID
	ChatJID                   types.JID
	LastMessageTimestamp      time.Time
	Archived                  *bool
	Pinned                    *bool
	MuteEndTime               time.Time
	EndOfHistoryTransferType  *waHistorySync.Conversation_EndOfHistoryTransferType
	EphemeralExpiration       *uint32
	EphemeralSettingTimestamp *int64
	MarkedAsUnread            *bool
	UnreadCount               *uint32
}

func NewConversation

func NewConversation(loginID networkid.UserLoginID, chatJID types.JID, conv *waHistorySync.Conversation) *Conversation

func (*Conversation) Scan

func (c *Conversation) Scan(row dbutil.Scannable) (*Conversation, error)

type ConversationQuery

type ConversationQuery struct {
	BridgeID networkid.BridgeID
	*dbutil.QueryHelper[*Conversation]
}

func (*ConversationQuery) Delete

func (cq *ConversationQuery) Delete(ctx context.Context, loginID networkid.UserLoginID, chatJID types.JID) error

func (*ConversationQuery) DeleteAll

func (cq *ConversationQuery) DeleteAll(ctx context.Context, loginID networkid.UserLoginID) error

func (*ConversationQuery) Get

func (cq *ConversationQuery) Get(ctx context.Context, loginID networkid.UserLoginID, chatJID types.JID) (*Conversation, error)

func (*ConversationQuery) GetRecent

func (cq *ConversationQuery) GetRecent(ctx context.Context, loginID networkid.UserLoginID, limit int) ([]*Conversation, error)

func (*ConversationQuery) Put

func (cq *ConversationQuery) Put(ctx context.Context, conv *Conversation) error

type Database

type Database struct {
	*dbutil.Database
	Conversation *ConversationQuery
	Message      *MessageQuery
	PollOption   *PollOptionQuery
	MediaRequest *MediaRequestQuery
}

func New

func New(bridgeID networkid.BridgeID, db *dbutil.Database, log zerolog.Logger) *Database

type HistorySyncMessageTuple

type HistorySyncMessageTuple struct {
	Info    *types.MessageInfo
	Message []byte
}

func (*HistorySyncMessageTuple) GetMassInsertValues

func (t *HistorySyncMessageTuple) GetMassInsertValues() [4]any

type MediaBackfillRequestStatus

type MediaBackfillRequestStatus int
const (
	MediaBackfillRequestStatusNotRequested   MediaBackfillRequestStatus = 0
	MediaBackfillRequestStatusRequested      MediaBackfillRequestStatus = 1
	MediaBackfillRequestStatusRequestFailed  MediaBackfillRequestStatus = 2
	MediaBackfillRequestStatusRequestSkipped MediaBackfillRequestStatus = 3
)

type MediaRequest

type MediaRequest struct {
	BridgeID    networkid.BridgeID
	UserLoginID networkid.UserLoginID
	MessageID   networkid.MessageID
	PortalKey   networkid.PortalKey
	MediaKey    []byte
	Status      MediaBackfillRequestStatus
	Error       string
}

func (*MediaRequest) Scan

func (mr *MediaRequest) Scan(row dbutil.Scannable) (*MediaRequest, error)

type MediaRequestQuery

type MediaRequestQuery struct {
	BridgeID networkid.BridgeID
	*dbutil.QueryHelper[*MediaRequest]
}

func (*MediaRequestQuery) Delete

func (mrq *MediaRequestQuery) Delete(ctx context.Context, loginID networkid.UserLoginID, messageID networkid.MessageID) error

func (*MediaRequestQuery) GetUnrequestedForUserLogin

func (mrq *MediaRequestQuery) GetUnrequestedForUserLogin(ctx context.Context, loginID networkid.UserLoginID) ([]*MediaRequest, error)

func (*MediaRequestQuery) Put

func (mrq *MediaRequestQuery) Put(ctx context.Context, mr *MediaRequest) error

type MessageQuery

type MessageQuery struct {
	BridgeID networkid.BridgeID
	*dbutil.Database
}

func (*MessageQuery) ConversationHasMessages

func (mq *MessageQuery) ConversationHasMessages(ctx context.Context, loginID networkid.UserLoginID, chatJID types.JID) (exists bool, err error)

func (*MessageQuery) DeleteAll

func (mq *MessageQuery) DeleteAll(ctx context.Context, loginID networkid.UserLoginID) error

func (*MessageQuery) DeleteAllInChat

func (mq *MessageQuery) DeleteAllInChat(ctx context.Context, loginID networkid.UserLoginID, chatJID types.JID) error

func (*MessageQuery) DeleteBetween

func (mq *MessageQuery) DeleteBetween(ctx context.Context, loginID networkid.UserLoginID, chatJID types.JID, before, after uint64) error

func (*MessageQuery) GetBetween

func (mq *MessageQuery) GetBetween(ctx context.Context, loginID networkid.UserLoginID, chatJID types.JID, startTime, endTime *time.Time, limit int) ([]*waWeb.WebMessageInfo, error)

func (*MessageQuery) Put

func (mq *MessageQuery) Put(ctx context.Context, loginID networkid.UserLoginID, chatJID types.JID, messages []*HistorySyncMessageTuple) error

type PollOptionQuery

type PollOptionQuery struct {
	BridgeID networkid.BridgeID
	*dbutil.Database
}

func (*PollOptionQuery) GetHashes

func (poq *PollOptionQuery) GetHashes(ctx context.Context, mxid id.EventID, ids []string) (map[string][32]byte, error)

func (*PollOptionQuery) GetIDs

func (poq *PollOptionQuery) GetIDs(ctx context.Context, mxid id.EventID, hashes [][]byte) (map[[32]byte]string, error)

func (*PollOptionQuery) Put

func (poq *PollOptionQuery) Put(ctx context.Context, mxid id.EventID, opts map[[32]byte]string) error

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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