database

package
v0.0.0-...-892f056 Latest Latest
Warning

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

Go to latest
Published: Nov 27, 2024 License: AGPL-3.0 Imports: 13 Imported by: 0

Documentation

Index

Constants

View Source
const (
	KVSendStatusStart    = "com.beeper.send_status_start"
	KVBridgeWasConnected = "bridge_was_connected"
	KVBridgeFirstConnect = "bridge_first_connect"
	KVBridgeInfoVersion  = "bridge_info_version"
	KVLookedForPortals   = "looked_for_portals"

	ExpectedBridgeInfoVersion = "1"
)

Variables

This section is empty.

Functions

This section is empty.

Types

type Backfill

type Backfill struct {

	// Fields
	QueueID        int
	UserID         id.UserID
	Priority       int
	PortalGUID     string
	TimeStart      *time.Time
	TimeEnd        *time.Time
	MaxBatchEvents int
	MaxTotalEvents int
	BatchDelay     int
	DispatchTime   *time.Time
	CompletedAt    *time.Time
	// contains filtered or unexported fields
}

func (*Backfill) Insert

func (b *Backfill) Insert(txn dbutil.Execable)

func (*Backfill) MarkDispatched

func (b *Backfill) MarkDispatched()

func (*Backfill) MarkDone

func (b *Backfill) MarkDone()

func (*Backfill) Scan

func (b *Backfill) Scan(row dbutil.Scannable) *Backfill

func (*Backfill) String

func (b *Backfill) String() string

type BackfillQuery

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

func (*BackfillQuery) Count

func (bq *BackfillQuery) Count(ctx context.Context, userID id.UserID) (count int, err error)

func (*BackfillQuery) DeleteAll

func (bq *BackfillQuery) DeleteAll(userID id.UserID)

func (*BackfillQuery) DeleteAllForPortal

func (bq *BackfillQuery) DeleteAllForPortal(userID id.UserID, portalGUID string)

func (*BackfillQuery) GetBackfillState

func (bq *BackfillQuery) GetBackfillState(userID id.UserID, portalGUID string) (backfillState *BackfillState)

func (*BackfillQuery) GetNext

func (bq *BackfillQuery) GetNext(userID id.UserID) (backfill *Backfill)

GetNext returns the next backfill to perform

func (*BackfillQuery) IncompleteCount

func (bq *BackfillQuery) IncompleteCount(ctx context.Context, userID id.UserID) (incompleteCount int, err error)

func (*BackfillQuery) New

func (bq *BackfillQuery) New() *Backfill

func (*BackfillQuery) NewBackfillState

func (bq *BackfillQuery) NewBackfillState(userID id.UserID, portalGUID string) *BackfillState

func (*BackfillQuery) NewWithValues

func (bq *BackfillQuery) NewWithValues(userID id.UserID, priority int, portalGUID string, timeStart, timeEnd *time.Time, maxBatchEvents, maxTotalEvents, batchDelay int) *Backfill

type BackfillState

type BackfillState struct {

	// Fields
	UserID                 id.UserID
	PortalGUID             string
	ProcessingBatch        bool
	BackfillComplete       bool
	FirstExpectedTimestamp uint64
	// contains filtered or unexported fields
}

func (*BackfillState) Scan

func (*BackfillState) SetProcessingBatch

func (b *BackfillState) SetProcessingBatch(processing bool)

func (*BackfillState) Upsert

func (b *BackfillState) Upsert()

type Database

type Database struct {
	*dbutil.Database

	User       *UserQuery
	Portal     *PortalQuery
	Puppet     *PuppetQuery
	Message    *MessageQuery
	Tapback    *TapbackQuery
	KV         *KeyValueQuery
	MergedChat *MergedChatQuery
	Backfill   *BackfillQuery
}

func New

func New(parent *dbutil.Database, log maulogger.Logger) *Database

type KeyValueQuery

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

func (*KeyValueQuery) Delete

func (kvq *KeyValueQuery) Delete(key string)

func (*KeyValueQuery) Get

func (kvq *KeyValueQuery) Get(key string) (value string)

func (*KeyValueQuery) Set

func (kvq *KeyValueQuery) Set(key, value string)

type MergedChatQuery

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

func (*MergedChatQuery) Get

func (mcq *MergedChatQuery) Get(guid string) (target string)

func (*MergedChatQuery) GetAllForTarget

func (mcq *MergedChatQuery) GetAllForTarget(guid string) (sources []string)

func (*MergedChatQuery) Remove

func (mcq *MergedChatQuery) Remove(guid string)

func (*MergedChatQuery) Set

func (mcq *MergedChatQuery) Set(txn dbutil.Execable, target string, sources ...string)

type Message

type Message struct {
	PortalGUID string
	GUID       string
	Part       int
	MXID       id.EventID
	SenderGUID string
	HandleGUID string
	Timestamp  int64
	// contains filtered or unexported fields
}

func (*Message) Delete

func (msg *Message) Delete()

func (*Message) Insert

func (msg *Message) Insert(txn dbutil.Execable)

func (*Message) Scan

func (msg *Message) Scan(row dbutil.Scannable) *Message

func (*Message) Time

func (msg *Message) Time() time.Time

type MessageQuery

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

func (*MessageQuery) FindChatByGUID

func (mq *MessageQuery) FindChatByGUID(guid string) (chatGUID string)

func (*MessageQuery) GetByGUID

func (mq *MessageQuery) GetByGUID(chat string, guid string, part int) *Message

func (*MessageQuery) GetByMXID

func (mq *MessageQuery) GetByMXID(mxid id.EventID) *Message

func (*MessageQuery) GetEarliestTimestampInChat

func (mq *MessageQuery) GetEarliestTimestampInChat(chat string) (int64, error)

func (*MessageQuery) GetFirstInChat

func (mq *MessageQuery) GetFirstInChat(chat string) *Message

func (*MessageQuery) GetIDsSince

func (mq *MessageQuery) GetIDsSince(chat string, since time.Time) (messages []string)

func (*MessageQuery) GetLastByGUID

func (mq *MessageQuery) GetLastByGUID(chat string, guid string) *Message

func (*MessageQuery) GetLastInChat

func (mq *MessageQuery) GetLastInChat(chat string) *Message

func (*MessageQuery) MergePortalGUID

func (mq *MessageQuery) MergePortalGUID(txn dbutil.Execable, to string, from ...string) int64

func (*MessageQuery) New

func (mq *MessageQuery) New() *Message

func (*MessageQuery) SplitPortalGUID

func (mq *MessageQuery) SplitPortalGUID(txn dbutil.Execable, fromHandle, fromPortal, to string) int64

type Portal

type Portal struct {
	GUID string
	MXID id.RoomID

	Name            string
	AvatarHash      *[32]byte
	AvatarURL       id.ContentURI
	Encrypted       bool
	BackfillStartTS int64
	InSpace         bool
	ThreadID        string
	LastSeenHandle  string

	FirstEventID id.EventID
	NextBatchID  id.BatchID
	// contains filtered or unexported fields
}

func (*Portal) Delete

func (portal *Portal) Delete()

func (*Portal) Insert

func (portal *Portal) Insert(txn dbutil.Execable)

func (*Portal) ReID

func (portal *Portal) ReID(newGUID string)

func (*Portal) Scan

func (portal *Portal) Scan(row dbutil.Scannable) *Portal

func (*Portal) Update

func (portal *Portal) Update(txn dbutil.Execable)

type PortalQuery

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

func (*PortalQuery) Count

func (pq *PortalQuery) Count() (count int)

func (*PortalQuery) FindByThreadID

func (pq *PortalQuery) FindByThreadID(threadID string) []*Portal

func (*PortalQuery) FindPrivateChats

func (pq *PortalQuery) FindPrivateChats() []*Portal

func (*PortalQuery) GetAllWithMXID

func (pq *PortalQuery) GetAllWithMXID() []*Portal

func (*PortalQuery) GetByGUID

func (pq *PortalQuery) GetByGUID(guid string) *Portal

func (*PortalQuery) GetByMXID

func (pq *PortalQuery) GetByMXID(mxid id.RoomID) *Portal

func (*PortalQuery) New

func (pq *PortalQuery) New() *Portal

type Puppet

type Puppet struct {
	ID             string
	Displayname    string
	NameOverridden bool
	AvatarHash     *[32]byte
	AvatarURL      id.ContentURI
	ContactInfoSet bool
	// contains filtered or unexported fields
}

func (*Puppet) Insert

func (puppet *Puppet) Insert()

func (*Puppet) Scan

func (puppet *Puppet) Scan(row dbutil.Scannable) *Puppet

func (*Puppet) Update

func (puppet *Puppet) Update()

type PuppetQuery

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

func (*PuppetQuery) Get

func (pq *PuppetQuery) Get(id string) *Puppet

func (*PuppetQuery) GetAll

func (pq *PuppetQuery) GetAll() (puppets []*Puppet)

func (*PuppetQuery) New

func (pq *PuppetQuery) New() *Puppet

type Tapback

type Tapback struct {
	PortalGUID  string
	GUID        string
	MessageGUID string
	MessagePart int
	SenderGUID  string
	HandleGUID  string
	Type        imessage.TapbackType
	MXID        id.EventID
	// contains filtered or unexported fields
}

func (*Tapback) Delete

func (tapback *Tapback) Delete()

func (*Tapback) Insert

func (tapback *Tapback) Insert(txn dbutil.Execable)

func (*Tapback) Scan

func (tapback *Tapback) Scan(row dbutil.Scannable) *Tapback

func (*Tapback) Update

func (tapback *Tapback) Update()

type TapbackQuery

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

func (*TapbackQuery) GetByGUID

func (mq *TapbackQuery) GetByGUID(chat, message string, part int, sender string) *Tapback

func (*TapbackQuery) GetByMXID

func (mq *TapbackQuery) GetByMXID(mxid id.EventID) *Tapback

func (*TapbackQuery) GetByTapbackGUID

func (mq *TapbackQuery) GetByTapbackGUID(chat, tapback string) *Tapback

func (*TapbackQuery) New

func (mq *TapbackQuery) New() *Tapback

type User

type User struct {
	MXID           id.UserID
	AccessToken    string
	NextBatch      string
	SpaceRoom      id.RoomID
	ManagementRoom id.RoomID
	// contains filtered or unexported fields
}

func (*User) Insert

func (user *User) Insert()

func (*User) Scan

func (user *User) Scan(row dbutil.Scannable) *User

func (*User) Update

func (user *User) Update()

type UserQuery

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

func (*UserQuery) GetByMXID

func (uq *UserQuery) GetByMXID(userID id.UserID) *User

func (*UserQuery) New

func (uq *UserQuery) New() *User

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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