db

package
v0.2.18 Latest Latest
Warning

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

Go to latest
Published: Mar 8, 2026 License: MIT Imports: 12 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ResolveMessageText

func ResolveMessageText(rawMessage string, msgType string, textContent string, format MessageFormat) string

Types

type BridgeLookup

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

BridgeLookup resolves DM names via platform bridge databases.

func NewBridgeLookup

func NewBridgeLookup(indexDBPath string, overrideRoot string) (*BridgeLookup, error)

NewBridgeLookup discovers megabridge.db files under the Beeper support directory.

func (*BridgeLookup) Count added in v0.2.1

func (b *BridgeLookup) Count() int

Count returns the number of discovered bridge databases.

func (*BridgeLookup) LookupDMName

func (b *BridgeLookup) LookupDMName(ctx context.Context, roomID string, accountID string) (string, bool, error)

LookupDMName attempts to resolve a DM name for the given room ID.

func (*BridgeLookup) Platforms added in v0.2.1

func (b *BridgeLookup) Platforms() []string

Platforms returns the list of platforms with discovered bridge databases.

type Message

type Message struct {
	ID         int64
	EventID    string
	ThreadID   string
	SenderID   string
	Timestamp  time.Time
	IsSentByMe bool
	Type       string
	Text       string
	Score      float64
	SenderName string
	AccountID  string
	ThreadName string
	ThreadType string
}

type MessageFormat

type MessageFormat string
const (
	FormatPlain MessageFormat = "plain"
	FormatRich  MessageFormat = "rich"
)

type MessageListOptions

type MessageListOptions struct {
	ThreadID string
	Limit    int
	After    *time.Time
	Before   *time.Time
	Format   MessageFormat
}

type Participant

type Participant struct {
	ID     string
	Name   string
	IsSelf bool
}

type SearchOptions

type SearchOptions struct {
	Query      string
	ThreadIDs  []string
	AccountIDs []string
	Days       int
	After      *time.Time
	Before     *time.Time
	Limit      int
	Context    int
	Window     time.Duration
	Format     MessageFormat
}

type SearchResult

type SearchResult struct {
	Match   Message
	Context []Message
}

type Store

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

func Open

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

func OpenWithOptions

func OpenWithOptions(path string, opts StoreOptions) (*Store, error)

func (*Store) Close

func (s *Store) Close() error

func (*Store) GetMessageWithContext

func (s *Store) GetMessageWithContext(ctx context.Context, messageID string, contextSize int, format MessageFormat) ([]Message, Thread, int, error)

func (*Store) GetThread

func (s *Store) GetThread(ctx context.Context, threadID string) (Thread, error)

func (*Store) HasFTS

func (s *Store) HasFTS(ctx context.Context) (bool, error)

func (*Store) LatestMessage

func (s *Store) LatestMessage(ctx context.Context, threadID string, format MessageFormat) (Message, error)

func (*Store) ListMessages

func (s *Store) ListMessages(ctx context.Context, opts MessageListOptions) ([]Message, Thread, error)

func (*Store) ListThreads

func (s *Store) ListThreads(ctx context.Context, opts ThreadListOptions) ([]Thread, error)

func (*Store) SearchMessages

func (s *Store) SearchMessages(ctx context.Context, opts SearchOptions) ([]SearchResult, error)

type StoreOptions

type StoreOptions struct {
	BridgeLookup bool
	BridgeRoot   string
}

type Thread

type Thread struct {
	ID           string
	AccountID    string
	Title        string
	Name         string
	Type         string
	DisplayName  string
	Participants []Participant
	UnreadCount  int
	IsUnread     bool
	IsMuted      bool
	IsPinned     bool
	IsArchived   bool
	LastActivity time.Time
}

type ThreadListOptions

type ThreadListOptions struct {
	AccountIDs []string
	Limit      int
}

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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