Documentation ¶
Index ¶
- Constants
- Variables
- func GetNumberFromMap[T constraints.Integer | constraints.Float](m map[string]any, key string) (T, bool)
- type BackfillTask
- type BackfillTaskQuery
- func (btq *BackfillTaskQuery) Delete(ctx context.Context, portalKey networkid.PortalKey) error
- func (btq *BackfillTaskQuery) EnsureExists(ctx context.Context, portal networkid.PortalKey, loginID networkid.UserLoginID) error
- func (btq *BackfillTaskQuery) GetNext(ctx context.Context) (*BackfillTask, error)
- func (btq *BackfillTaskQuery) MarkDispatched(ctx context.Context, bq *BackfillTask) error
- func (btq *BackfillTaskQuery) Update(ctx context.Context, bq *BackfillTask) error
- func (btq *BackfillTaskQuery) Upsert(ctx context.Context, bq *BackfillTask) error
- type Database
- type DisappearingMessage
- type DisappearingMessageQuery
- func (dmq *DisappearingMessageQuery) Delete(ctx context.Context, eventID id.EventID) error
- func (dmq *DisappearingMessageQuery) GetUpcoming(ctx context.Context, duration time.Duration) ([]*DisappearingMessage, error)
- func (dmq *DisappearingMessageQuery) Put(ctx context.Context, dm *DisappearingMessage) error
- func (dmq *DisappearingMessageQuery) StartAll(ctx context.Context, roomID id.RoomID) ([]*DisappearingMessage, error)
- type DisappearingSetting
- type DisappearingType
- type Ghost
- type GhostQuery
- func (gq *GhostQuery) GetByID(ctx context.Context, id networkid.UserID) (*Ghost, error)
- func (gq *GhostQuery) GetByMetadata(ctx context.Context, key string, value any) ([]*Ghost, error)
- func (gq *GhostQuery) Insert(ctx context.Context, ghost *Ghost) error
- func (gq *GhostQuery) Update(ctx context.Context, ghost *Ghost) error
- type KVQuery
- type Key
- type Message
- type MessageQuery
- func (mq *MessageQuery) CountMessagesInPortal(ctx context.Context, key networkid.PortalKey) (count int, err error)
- func (mq *MessageQuery) Delete(ctx context.Context, rowID int64) error
- func (mq *MessageQuery) DeleteAllParts(ctx context.Context, receiver networkid.UserLoginID, id networkid.MessageID) error
- func (mq *MessageQuery) GetAllPartsByID(ctx context.Context, receiver networkid.UserLoginID, id networkid.MessageID) ([]*Message, error)
- func (mq *MessageQuery) GetByRowID(ctx context.Context, rowID int64) (*Message, error)
- func (mq *MessageQuery) GetFirstOrSpecificPartByID(ctx context.Context, receiver networkid.UserLoginID, ...) (*Message, error)
- func (mq *MessageQuery) GetFirstPartByID(ctx context.Context, receiver networkid.UserLoginID, id networkid.MessageID) (*Message, error)
- func (mq *MessageQuery) GetFirstPortalMessage(ctx context.Context, portal networkid.PortalKey) (*Message, error)
- func (mq *MessageQuery) GetFirstThreadMessage(ctx context.Context, portal networkid.PortalKey, ...) (*Message, error)
- func (mq *MessageQuery) GetLastPartAtOrBeforeTime(ctx context.Context, portal networkid.PortalKey, maxTS time.Time) (*Message, error)
- func (mq *MessageQuery) GetLastPartByID(ctx context.Context, receiver networkid.UserLoginID, id networkid.MessageID) (*Message, error)
- func (mq *MessageQuery) GetLastThreadMessage(ctx context.Context, portal networkid.PortalKey, ...) (*Message, error)
- func (mq *MessageQuery) GetMessagesBetweenTimeQuery(ctx context.Context, portal networkid.PortalKey, start, end time.Time) ([]*Message, error)
- func (mq *MessageQuery) GetPartByID(ctx context.Context, receiver networkid.UserLoginID, id networkid.MessageID, ...) (*Message, error)
- func (mq *MessageQuery) GetPartByMXID(ctx context.Context, mxid id.EventID) (*Message, error)
- func (mq *MessageQuery) Insert(ctx context.Context, msg *Message) error
- func (mq *MessageQuery) Update(ctx context.Context, msg *Message) error
- type MetaMerger
- type MetaTypeCreator
- type MetaTypes
- type Portal
- type PortalQuery
- func (pq *PortalQuery) Delete(ctx context.Context, key networkid.PortalKey) error
- func (pq *PortalQuery) FindReceiver(ctx context.Context, id networkid.PortalID, ...) (key networkid.PortalKey, err error)
- func (pq *PortalQuery) GetAll(ctx context.Context) ([]*Portal, error)
- func (pq *PortalQuery) GetAllDMsWith(ctx context.Context, otherUserID networkid.UserID) ([]*Portal, error)
- func (pq *PortalQuery) GetAllWithMXID(ctx context.Context) ([]*Portal, error)
- func (pq *PortalQuery) GetByIDWithUncertainReceiver(ctx context.Context, key networkid.PortalKey) (*Portal, error)
- func (pq *PortalQuery) GetByKey(ctx context.Context, key networkid.PortalKey) (*Portal, error)
- func (pq *PortalQuery) GetByMXID(ctx context.Context, mxid id.RoomID) (*Portal, error)
- func (pq *PortalQuery) GetChildren(ctx context.Context, parentKey networkid.PortalKey) ([]*Portal, error)
- func (pq *PortalQuery) Insert(ctx context.Context, p *Portal) error
- func (pq *PortalQuery) MigrateToSplitPortals(ctx context.Context) (int64, error)
- func (pq *PortalQuery) ReID(ctx context.Context, oldID, newID networkid.PortalKey) error
- func (pq *PortalQuery) Update(ctx context.Context, p *Portal) error
- type Reaction
- type ReactionQuery
- func (rq *ReactionQuery) Delete(ctx context.Context, reaction *Reaction) error
- func (rq *ReactionQuery) GetAllToMessage(ctx context.Context, messageID networkid.MessageID) ([]*Reaction, error)
- func (rq *ReactionQuery) GetAllToMessageBySender(ctx context.Context, messageID networkid.MessageID, senderID networkid.UserID) ([]*Reaction, error)
- func (rq *ReactionQuery) GetAllToMessagePart(ctx context.Context, messageID networkid.MessageID, partID networkid.PartID) ([]*Reaction, error)
- func (rq *ReactionQuery) GetByID(ctx context.Context, messageID networkid.MessageID, ...) (*Reaction, error)
- func (rq *ReactionQuery) GetByIDWithoutMessagePart(ctx context.Context, messageID networkid.MessageID, senderID networkid.UserID, ...) (*Reaction, error)
- func (rq *ReactionQuery) GetByMXID(ctx context.Context, mxid id.EventID) (*Reaction, error)
- func (rq *ReactionQuery) Upsert(ctx context.Context, reaction *Reaction) error
- type RoomType
- type User
- type UserLogin
- type UserLoginQuery
- func (uq *UserLoginQuery) Delete(ctx context.Context, loginID networkid.UserLoginID) error
- func (uq *UserLoginQuery) GetAllForUser(ctx context.Context, userID id.UserID) ([]*UserLogin, error)
- func (uq *UserLoginQuery) GetAllInPortal(ctx context.Context, portal networkid.PortalKey) ([]*UserLogin, error)
- func (uq *UserLoginQuery) GetAllUserIDsWithLogins(ctx context.Context) ([]id.UserID, error)
- func (uq *UserLoginQuery) GetByID(ctx context.Context, id networkid.UserLoginID) (*UserLogin, error)
- func (uq *UserLoginQuery) Insert(ctx context.Context, login *UserLogin) error
- func (uq *UserLoginQuery) Update(ctx context.Context, login *UserLogin) error
- type UserPortal
- type UserPortalQuery
- func (upq *UserPortalQuery) Delete(ctx context.Context, up *UserPortal) error
- func (upq *UserPortalQuery) Get(ctx context.Context, login *UserLogin, portal networkid.PortalKey) (*UserPortal, error)
- func (upq *UserPortalQuery) GetAllForLogin(ctx context.Context, login *UserLogin) ([]*UserPortal, error)
- func (upq *UserPortalQuery) GetAllForUserInPortal(ctx context.Context, userID id.UserID, portal networkid.PortalKey) ([]*UserPortal, error)
- func (upq *UserPortalQuery) GetAllInPortal(ctx context.Context, portal networkid.PortalKey) ([]*UserPortal, error)
- func (upq *UserPortalQuery) GetOrCreate(ctx context.Context, login *UserLogin, portal networkid.PortalKey) (*UserPortal, error)
- func (upq *UserPortalQuery) MarkAsPreferred(ctx context.Context, login *UserLogin, portal networkid.PortalKey) error
- func (upq *UserPortalQuery) Put(ctx context.Context, up *UserPortal) error
- type UserQuery
Constants ¶
View Source
const FakeMXIDPrefix = "~fake:"
View Source
const UnfinishedBackfillBackoff = 1 * time.Hour
Variables ¶
View Source
var BackfillNextDispatchNever = time.Unix(0, (1<<63)-1)
Functions ¶
func GetNumberFromMap ¶
func GetNumberFromMap[T constraints.Integer | constraints.Float](m map[string]any, key string) (T, bool)
Types ¶
type BackfillTask ¶ added in v0.20.0
type BackfillTask struct { BridgeID networkid.BridgeID PortalKey networkid.PortalKey UserLoginID networkid.UserLoginID BatchCount int IsDone bool Cursor networkid.PaginationCursor OldestMessageID networkid.MessageID DispatchedAt time.Time CompletedAt time.Time NextDispatchMinTS time.Time }
func (*BackfillTask) Scan ¶ added in v0.20.0
func (bt *BackfillTask) Scan(row dbutil.Scannable) (*BackfillTask, error)
type BackfillTaskQuery ¶ added in v0.20.0
type BackfillTaskQuery struct { BridgeID networkid.BridgeID *dbutil.QueryHelper[*BackfillTask] }
func (*BackfillTaskQuery) EnsureExists ¶ added in v0.20.0
func (btq *BackfillTaskQuery) EnsureExists(ctx context.Context, portal networkid.PortalKey, loginID networkid.UserLoginID) error
func (*BackfillTaskQuery) GetNext ¶ added in v0.20.0
func (btq *BackfillTaskQuery) GetNext(ctx context.Context) (*BackfillTask, error)
func (*BackfillTaskQuery) MarkDispatched ¶ added in v0.20.0
func (btq *BackfillTaskQuery) MarkDispatched(ctx context.Context, bq *BackfillTask) error
func (*BackfillTaskQuery) Update ¶ added in v0.20.0
func (btq *BackfillTaskQuery) Update(ctx context.Context, bq *BackfillTask) error
func (*BackfillTaskQuery) Upsert ¶ added in v0.20.0
func (btq *BackfillTaskQuery) Upsert(ctx context.Context, bq *BackfillTask) error
type Database ¶
type Database struct { *dbutil.Database BridgeID networkid.BridgeID Portal *PortalQuery Ghost *GhostQuery Message *MessageQuery DisappearingMessage *DisappearingMessageQuery Reaction *ReactionQuery User *UserQuery UserLogin *UserLoginQuery UserPortal *UserPortalQuery BackfillTask *BackfillTaskQuery KV *KVQuery }
type DisappearingMessage ¶
type DisappearingMessage struct { BridgeID networkid.BridgeID RoomID id.RoomID EventID id.EventID DisappearingSetting }
func (*DisappearingMessage) Scan ¶
func (d *DisappearingMessage) Scan(row dbutil.Scannable) (*DisappearingMessage, error)
type DisappearingMessageQuery ¶
type DisappearingMessageQuery struct { BridgeID networkid.BridgeID *dbutil.QueryHelper[*DisappearingMessage] }
func (*DisappearingMessageQuery) GetUpcoming ¶
func (dmq *DisappearingMessageQuery) GetUpcoming(ctx context.Context, duration time.Duration) ([]*DisappearingMessage, error)
func (*DisappearingMessageQuery) Put ¶
func (dmq *DisappearingMessageQuery) Put(ctx context.Context, dm *DisappearingMessage) error
func (*DisappearingMessageQuery) StartAll ¶
func (dmq *DisappearingMessageQuery) StartAll(ctx context.Context, roomID id.RoomID) ([]*DisappearingMessage, error)
type DisappearingSetting ¶
type DisappearingSetting struct { Type DisappearingType Timer time.Duration DisappearAt time.Time }
DisappearingSetting represents a disappearing message timer setting by combining a type with a timer and an optional start timestamp.
type DisappearingType ¶
type DisappearingType string
DisappearingType represents the type of a disappearing message timer.
const ( DisappearingTypeNone DisappearingType = "" DisappearingTypeAfterRead DisappearingType = "after_read" DisappearingTypeAfterSend DisappearingType = "after_send" )
type Ghost ¶
type GhostQuery ¶
type GhostQuery struct { BridgeID networkid.BridgeID MetaType MetaTypeCreator *dbutil.QueryHelper[*Ghost] }
func (*GhostQuery) GetByMetadata ¶ added in v0.20.0
GetByMetadata returns the ghosts whose metadata field at the given JSON key matches the given value.
type Key ¶ added in v0.21.0
type Key string
const (
KeySplitPortalsEnabled Key = "split_portals_enabled"
)
type Message ¶
type Message struct { RowID int64 BridgeID networkid.BridgeID ID networkid.MessageID PartID networkid.PartID MXID id.EventID Room networkid.PortalKey SenderID networkid.UserID SenderMXID id.UserID Timestamp time.Time EditCount int ThreadRoot networkid.MessageID ReplyTo networkid.MessageOptionalPartID Metadata any }
func (*Message) HasFakeMXID ¶ added in v0.20.0
func (*Message) SetFakeMXID ¶ added in v0.20.0
func (m *Message) SetFakeMXID()
type MessageQuery ¶
type MessageQuery struct { BridgeID networkid.BridgeID MetaType MetaTypeCreator *dbutil.QueryHelper[*Message] }
func (*MessageQuery) CountMessagesInPortal ¶ added in v0.20.0
func (*MessageQuery) Delete ¶
func (mq *MessageQuery) Delete(ctx context.Context, rowID int64) error
func (*MessageQuery) DeleteAllParts ¶
func (mq *MessageQuery) DeleteAllParts(ctx context.Context, receiver networkid.UserLoginID, id networkid.MessageID) error
func (*MessageQuery) GetAllPartsByID ¶
func (mq *MessageQuery) GetAllPartsByID(ctx context.Context, receiver networkid.UserLoginID, id networkid.MessageID) ([]*Message, error)
func (*MessageQuery) GetByRowID ¶
func (*MessageQuery) GetFirstOrSpecificPartByID ¶
func (mq *MessageQuery) GetFirstOrSpecificPartByID(ctx context.Context, receiver networkid.UserLoginID, id networkid.MessageOptionalPartID) (*Message, error)
func (*MessageQuery) GetFirstPartByID ¶
func (mq *MessageQuery) GetFirstPartByID(ctx context.Context, receiver networkid.UserLoginID, id networkid.MessageID) (*Message, error)
func (*MessageQuery) GetFirstPortalMessage ¶ added in v0.20.0
func (*MessageQuery) GetFirstThreadMessage ¶
func (*MessageQuery) GetLastPartAtOrBeforeTime ¶
func (*MessageQuery) GetLastPartByID ¶
func (mq *MessageQuery) GetLastPartByID(ctx context.Context, receiver networkid.UserLoginID, id networkid.MessageID) (*Message, error)
func (*MessageQuery) GetLastThreadMessage ¶
func (*MessageQuery) GetMessagesBetweenTimeQuery ¶
func (*MessageQuery) GetPartByID ¶
func (*MessageQuery) GetPartByMXID ¶
type MetaMerger ¶
type MetaMerger interface {
CopyFrom(other any)
}
type MetaTypeCreator ¶
type MetaTypeCreator func() any
type MetaTypes ¶
type MetaTypes struct { Portal MetaTypeCreator Ghost MetaTypeCreator Message MetaTypeCreator Reaction MetaTypeCreator UserLogin MetaTypeCreator }
type Portal ¶
type Portal struct { BridgeID networkid.BridgeID networkid.PortalKey MXID id.RoomID ParentKey networkid.PortalKey RelayLoginID networkid.UserLoginID OtherUserID networkid.UserID Name string Topic string AvatarID networkid.AvatarID AvatarHash [32]byte AvatarMXC id.ContentURIString NameSet bool TopicSet bool AvatarSet bool NameIsCustom bool InSpace bool RoomType RoomType Disappear DisappearingSetting Metadata any }
type PortalQuery ¶
type PortalQuery struct { BridgeID networkid.BridgeID MetaType MetaTypeCreator *dbutil.QueryHelper[*Portal] }
func (*PortalQuery) FindReceiver ¶
func (pq *PortalQuery) FindReceiver(ctx context.Context, id networkid.PortalID, maybeReceiver networkid.UserLoginID) (key networkid.PortalKey, err error)
func (*PortalQuery) GetAll ¶ added in v0.20.0
func (pq *PortalQuery) GetAll(ctx context.Context) ([]*Portal, error)
func (*PortalQuery) GetAllDMsWith ¶ added in v0.20.0
func (*PortalQuery) GetAllWithMXID ¶
func (pq *PortalQuery) GetAllWithMXID(ctx context.Context) ([]*Portal, error)
func (*PortalQuery) GetByIDWithUncertainReceiver ¶
func (*PortalQuery) GetChildren ¶
func (*PortalQuery) MigrateToSplitPortals ¶ added in v0.21.0
func (pq *PortalQuery) MigrateToSplitPortals(ctx context.Context) (int64, error)
type Reaction ¶
type ReactionQuery ¶
type ReactionQuery struct { BridgeID networkid.BridgeID MetaType MetaTypeCreator *dbutil.QueryHelper[*Reaction] }
func (*ReactionQuery) Delete ¶
func (rq *ReactionQuery) Delete(ctx context.Context, reaction *Reaction) error
func (*ReactionQuery) GetAllToMessage ¶
func (*ReactionQuery) GetAllToMessageBySender ¶
func (*ReactionQuery) GetAllToMessagePart ¶ added in v0.20.0
func (*ReactionQuery) GetByIDWithoutMessagePart ¶
type User ¶
type UserLogin ¶
type UserLoginQuery ¶
type UserLoginQuery struct { BridgeID networkid.BridgeID MetaType MetaTypeCreator *dbutil.QueryHelper[*UserLogin] }
func (*UserLoginQuery) Delete ¶
func (uq *UserLoginQuery) Delete(ctx context.Context, loginID networkid.UserLoginID) error
func (*UserLoginQuery) GetAllForUser ¶
func (*UserLoginQuery) GetAllInPortal ¶
func (*UserLoginQuery) GetAllUserIDsWithLogins ¶
func (*UserLoginQuery) GetByID ¶
func (uq *UserLoginQuery) GetByID(ctx context.Context, id networkid.UserLoginID) (*UserLogin, error)
type UserPortal ¶
type UserPortal struct { BridgeID networkid.BridgeID UserMXID id.UserID LoginID networkid.UserLoginID Portal networkid.PortalKey InSpace *bool Preferred *bool LastRead time.Time }
func UserPortalFor ¶
func UserPortalFor(ul *UserLogin, portal networkid.PortalKey) *UserPortal
func (*UserPortal) CopyWithoutValues ¶
func (up *UserPortal) CopyWithoutValues() *UserPortal
func (*UserPortal) Scan ¶
func (up *UserPortal) Scan(row dbutil.Scannable) (*UserPortal, error)
type UserPortalQuery ¶
type UserPortalQuery struct { BridgeID networkid.BridgeID *dbutil.QueryHelper[*UserPortal] }
func (*UserPortalQuery) Delete ¶ added in v0.20.0
func (upq *UserPortalQuery) Delete(ctx context.Context, up *UserPortal) error
func (*UserPortalQuery) Get ¶
func (upq *UserPortalQuery) Get(ctx context.Context, login *UserLogin, portal networkid.PortalKey) (*UserPortal, error)
func (*UserPortalQuery) GetAllForLogin ¶
func (upq *UserPortalQuery) GetAllForLogin(ctx context.Context, login *UserLogin) ([]*UserPortal, error)
func (*UserPortalQuery) GetAllForUserInPortal ¶
func (upq *UserPortalQuery) GetAllForUserInPortal(ctx context.Context, userID id.UserID, portal networkid.PortalKey) ([]*UserPortal, error)
func (*UserPortalQuery) GetAllInPortal ¶
func (upq *UserPortalQuery) GetAllInPortal(ctx context.Context, portal networkid.PortalKey) ([]*UserPortal, error)
func (*UserPortalQuery) GetOrCreate ¶
func (upq *UserPortalQuery) GetOrCreate(ctx context.Context, login *UserLogin, portal networkid.PortalKey) (*UserPortal, error)
func (*UserPortalQuery) MarkAsPreferred ¶
func (*UserPortalQuery) Put ¶
func (upq *UserPortalQuery) Put(ctx context.Context, up *UserPortal) error
Source Files ¶
Click to show internal directories.
Click to hide internal directories.