Documentation ¶
Index ¶
- func GetRelatesToFromBytes(content []byte) (id.EventID, event.RelationType)
- type Account
- type AccountData
- type AccountDataQuery
- type AccountQuery
- func (aq *AccountQuery) Get(ctx context.Context, userID id.UserID) (*Account, error)
- func (aq *AccountQuery) GetFirstUserID(ctx context.Context) (userID id.UserID, err error)
- func (aq *AccountQuery) Put(ctx context.Context, account *Account) error
- func (aq *AccountQuery) PutNextBatch(ctx context.Context, userID id.UserID, nextBatch string) error
- type ClientStateStore
- func (c *ClientStateStore) ClearCachedMembers(ctx context.Context, roomID id.RoomID, memberships ...event.Membership) error
- func (c *ClientStateStore) FindSharedRooms(ctx context.Context, userID id.UserID) ([]id.RoomID, error)
- func (c *ClientStateStore) GetAllMembers(ctx context.Context, roomID id.RoomID) (map[id.UserID]*event.MemberEventContent, error)
- func (c *ClientStateStore) GetEncryptionEvent(ctx context.Context, roomID id.RoomID) (content *event.EncryptionEventContent, err error)
- func (c *ClientStateStore) GetMember(ctx context.Context, roomID id.RoomID, userID id.UserID) (*event.MemberEventContent, error)
- func (c *ClientStateStore) GetPowerLevels(ctx context.Context, roomID id.RoomID) (content *event.PowerLevelsEventContent, err error)
- func (c *ClientStateStore) GetRoomJoinedMembers(ctx context.Context, roomID id.RoomID) ([]id.UserID, error)
- func (c *ClientStateStore) GetRoomJoinedOrInvitedMembers(ctx context.Context, roomID id.RoomID) ([]id.UserID, error)
- func (c *ClientStateStore) HasFetchedMembers(ctx context.Context, roomID id.RoomID) (bool, error)
- func (c *ClientStateStore) IsConfusableName(ctx context.Context, roomID id.RoomID, currentUser id.UserID, name string) ([]id.UserID, error)
- func (c *ClientStateStore) IsEncrypted(ctx context.Context, roomID id.RoomID) (isEncrypted bool, err error)
- func (c *ClientStateStore) IsInRoom(ctx context.Context, roomID id.RoomID, userID id.UserID) bool
- func (c *ClientStateStore) IsInvited(ctx context.Context, roomID id.RoomID, userID id.UserID) bool
- func (c *ClientStateStore) IsMembership(ctx context.Context, roomID id.RoomID, userID id.UserID, ...) bool
- func (c *ClientStateStore) MarkMembersFetched(ctx context.Context, roomID id.RoomID) error
- func (c *ClientStateStore) ReplaceCachedMembers(ctx context.Context, roomID id.RoomID, evts []*event.Event, ...) error
- func (c *ClientStateStore) SetEncryptionEvent(ctx context.Context, roomID id.RoomID, content *event.EncryptionEventContent) error
- func (c *ClientStateStore) SetMember(ctx context.Context, roomID id.RoomID, userID id.UserID, ...) error
- func (c *ClientStateStore) SetMembership(ctx context.Context, roomID id.RoomID, userID id.UserID, ...) error
- func (c *ClientStateStore) SetPowerLevels(ctx context.Context, roomID id.RoomID, levels *event.PowerLevelsEventContent) error
- func (c *ClientStateStore) TryGetMember(ctx context.Context, roomID id.RoomID, userID id.UserID) (content *event.MemberEventContent, err error)
- func (c *ClientStateStore) UpdateState(ctx context.Context, evt *event.Event)
- type CurrentStateQuery
- func (csq *CurrentStateQuery) Get(ctx context.Context, roomID id.RoomID, eventType event.Type, stateKey string) (*Event, error)
- func (csq *CurrentStateQuery) GetAll(ctx context.Context, roomID id.RoomID) ([]*Event, error)
- func (csq *CurrentStateQuery) Set(ctx context.Context, roomID id.RoomID, eventType event.Type, stateKey string, ...) error
- type Database
- type Event
- type EventQuery
- func (eq *EventQuery) FillLastEditRowIDs(ctx context.Context, roomID id.RoomID, events []*Event) error
- func (eq *EventQuery) FillReactionCounts(ctx context.Context, roomID id.RoomID, events []*Event) error
- func (eq *EventQuery) GetByID(ctx context.Context, eventID id.EventID) (*Event, error)
- func (eq *EventQuery) GetByRowID(ctx context.Context, rowID EventRowID) (*Event, error)
- func (eq *EventQuery) GetByRowIDs(ctx context.Context, rowIDs ...EventRowID) ([]*Event, error)
- func (eq *EventQuery) GetEditRowIDs(ctx context.Context, roomID id.RoomID, eventIDs ...id.EventID) (map[id.EventID][]EventRowID, error)
- func (eq *EventQuery) GetFailedByMegolmSessionID(ctx context.Context, roomID id.RoomID, sessionID id.SessionID) ([]*Event, error)
- func (eq *EventQuery) GetReactions(ctx context.Context, roomID id.RoomID, eventIDs ...id.EventID) (map[id.EventID]*GetReactionsResult, error)
- func (eq *EventQuery) Insert(ctx context.Context, evt *Event) (rowID EventRowID, err error)
- func (eq *EventQuery) UpdateDecrypted(ctx context.Context, rowID EventRowID, decrypted json.RawMessage, ...) error
- func (eq *EventQuery) UpdateID(ctx context.Context, rowID EventRowID, newID id.EventID) error
- func (eq *EventQuery) Upsert(ctx context.Context, evt *Event) (rowID EventRowID, err error)
- type EventRowID
- type GetReactionsResult
- type NameQuality
- type Receipt
- type ReceiptQuery
- type Room
- type RoomQuery
- func (rq *RoomQuery) CreateRow(ctx context.Context, roomID id.RoomID) error
- func (rq *RoomQuery) Get(ctx context.Context, roomID id.RoomID) (*Room, error)
- func (rq *RoomQuery) SetPrevBatch(ctx context.Context, roomID id.RoomID, prevBatch string) error
- func (rq *RoomQuery) UpdatePreviewIfLaterOnTimeline(ctx context.Context, roomID id.RoomID, rowID EventRowID) (previewChanged bool, err error)
- func (rq *RoomQuery) Upsert(ctx context.Context, room *Room) error
- type SessionRequest
- type SessionRequestQuery
- type TimelineQuery
- func (tq *TimelineQuery) Append(ctx context.Context, roomID id.RoomID, rowIDs []EventRowID) ([]TimelineRowTuple, error)
- func (tq *TimelineQuery) Clear(ctx context.Context, roomID id.RoomID) error
- func (tq *TimelineQuery) Get(ctx context.Context, roomID id.RoomID, limit int, before TimelineRowID) ([]*Event, error)
- func (tq *TimelineQuery) Prepend(ctx context.Context, roomID id.RoomID, rowIDs []EventRowID) (prependEntries []TimelineRowTuple, err error)
- type TimelineRowID
- type TimelineRowTuple
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func GetRelatesToFromBytes ¶
func GetRelatesToFromBytes(content []byte) (id.EventID, event.RelationType)
Types ¶
type Account ¶
type AccountData ¶
func (*AccountData) Scan ¶
func (a *AccountData) Scan(row dbutil.Scannable) (*AccountData, error)
type AccountDataQuery ¶
type AccountDataQuery struct { *dbutil.QueryHelper[*AccountData] }
type AccountQuery ¶
type AccountQuery struct { *dbutil.QueryHelper[*Account] }
func (*AccountQuery) GetFirstUserID ¶
func (*AccountQuery) PutNextBatch ¶
type ClientStateStore ¶
type ClientStateStore struct {
*Database
}
func (*ClientStateStore) ClearCachedMembers ¶
func (c *ClientStateStore) ClearCachedMembers(ctx context.Context, roomID id.RoomID, memberships ...event.Membership) error
func (*ClientStateStore) FindSharedRooms ¶
func (*ClientStateStore) GetAllMembers ¶ added in v0.21.0
func (c *ClientStateStore) GetAllMembers(ctx context.Context, roomID id.RoomID) (map[id.UserID]*event.MemberEventContent, error)
func (*ClientStateStore) GetEncryptionEvent ¶
func (c *ClientStateStore) GetEncryptionEvent(ctx context.Context, roomID id.RoomID) (content *event.EncryptionEventContent, err error)
func (*ClientStateStore) GetMember ¶
func (c *ClientStateStore) GetMember(ctx context.Context, roomID id.RoomID, userID id.UserID) (*event.MemberEventContent, error)
func (*ClientStateStore) GetPowerLevels ¶
func (c *ClientStateStore) GetPowerLevels(ctx context.Context, roomID id.RoomID) (content *event.PowerLevelsEventContent, err error)
func (*ClientStateStore) GetRoomJoinedMembers ¶
func (*ClientStateStore) GetRoomJoinedOrInvitedMembers ¶
func (*ClientStateStore) HasFetchedMembers ¶ added in v0.21.0
func (*ClientStateStore) IsConfusableName ¶ added in v0.20.0
func (*ClientStateStore) IsEncrypted ¶
func (*ClientStateStore) IsMembership ¶
func (c *ClientStateStore) IsMembership(ctx context.Context, roomID id.RoomID, userID id.UserID, allowedMemberships ...event.Membership) bool
func (*ClientStateStore) MarkMembersFetched ¶ added in v0.21.0
func (*ClientStateStore) ReplaceCachedMembers ¶ added in v0.21.0
func (c *ClientStateStore) ReplaceCachedMembers(ctx context.Context, roomID id.RoomID, evts []*event.Event, onlyMemberships ...event.Membership) error
func (*ClientStateStore) SetEncryptionEvent ¶
func (c *ClientStateStore) SetEncryptionEvent(ctx context.Context, roomID id.RoomID, content *event.EncryptionEventContent) error
func (*ClientStateStore) SetMember ¶
func (c *ClientStateStore) SetMember(ctx context.Context, roomID id.RoomID, userID id.UserID, member *event.MemberEventContent) error
func (*ClientStateStore) SetMembership ¶
func (c *ClientStateStore) SetMembership(ctx context.Context, roomID id.RoomID, userID id.UserID, membership event.Membership) error
func (*ClientStateStore) SetPowerLevels ¶
func (c *ClientStateStore) SetPowerLevels(ctx context.Context, roomID id.RoomID, levels *event.PowerLevelsEventContent) error
func (*ClientStateStore) TryGetMember ¶
func (c *ClientStateStore) TryGetMember(ctx context.Context, roomID id.RoomID, userID id.UserID) (content *event.MemberEventContent, err error)
func (*ClientStateStore) UpdateState ¶
func (c *ClientStateStore) UpdateState(ctx context.Context, evt *event.Event)
type CurrentStateQuery ¶
type CurrentStateQuery struct { *dbutil.QueryHelper[*Event] }
func (*CurrentStateQuery) Set ¶
func (csq *CurrentStateQuery) Set(ctx context.Context, roomID id.RoomID, eventType event.Type, stateKey string, eventRowID EventRowID, membership event.Membership) error
type Database ¶
type Database struct { *dbutil.Database Account AccountQuery AccountData AccountDataQuery Room RoomQuery Event EventQuery CurrentState CurrentStateQuery Timeline TimelineQuery SessionRequest SessionRequestQuery Receipt ReceiptQuery }
type Event ¶
type Event struct { RowID EventRowID `json:"rowid"` TimelineRowID TimelineRowID `json:"timeline_rowid"` RoomID id.RoomID `json:"room_id"` ID id.EventID `json:"event_id"` Sender id.UserID `json:"sender"` Type string `json:"type"` StateKey *string `json:"state_key,omitempty"` Timestamp time.Time `json:"timestamp"` Content json.RawMessage `json:"content"` Decrypted json.RawMessage `json:"decrypted,omitempty"` DecryptedType string `json:"decrypted_type,omitempty"` Unsigned json.RawMessage `json:"unsigned,omitempty"` TransactionID string `json:"transaction_id,omitempty"` RedactedBy id.EventID `json:"redacted_by,omitempty"` RelatesTo id.EventID `json:"relates_to,omitempty"` RelationType event.RelationType `json:"relation_type,omitempty"` MegolmSessionID id.SessionID `json:"-,omitempty"` DecryptionError string `json:"decryption_error,omitempty"` Reactions map[string]int `json:"reactions,omitempty"` LastEditRowID *EventRowID `json:"last_edit_rowid,omitempty"` }
func MautrixToEvent ¶
func (*Event) AsRawMautrix ¶
func (*Event) BumpsSortingTimestamp ¶
func (*Event) CanUseForPreview ¶
type EventQuery ¶
type EventQuery struct { *dbutil.QueryHelper[*Event] }
func (*EventQuery) FillLastEditRowIDs ¶
func (*EventQuery) FillReactionCounts ¶
func (*EventQuery) GetByRowID ¶
func (eq *EventQuery) GetByRowID(ctx context.Context, rowID EventRowID) (*Event, error)
func (*EventQuery) GetByRowIDs ¶
func (eq *EventQuery) GetByRowIDs(ctx context.Context, rowIDs ...EventRowID) ([]*Event, error)
func (*EventQuery) GetEditRowIDs ¶
func (*EventQuery) GetFailedByMegolmSessionID ¶
func (*EventQuery) GetReactions ¶
func (*EventQuery) Insert ¶
func (eq *EventQuery) Insert(ctx context.Context, evt *Event) (rowID EventRowID, err error)
func (*EventQuery) UpdateDecrypted ¶
func (eq *EventQuery) UpdateDecrypted(ctx context.Context, rowID EventRowID, decrypted json.RawMessage, decryptedType string) error
func (*EventQuery) UpdateID ¶
func (eq *EventQuery) UpdateID(ctx context.Context, rowID EventRowID, newID id.EventID) error
func (*EventQuery) Upsert ¶
func (eq *EventQuery) Upsert(ctx context.Context, evt *Event) (rowID EventRowID, err error)
type EventRowID ¶
type EventRowID int64
func (EventRowID) GetMassInsertValues ¶
func (m EventRowID) GetMassInsertValues() [1]any
type GetReactionsResult ¶
type NameQuality ¶
type NameQuality int
const ( NameQualityNil NameQuality = iota NameQualityParticipants NameQualityCanonicalAlias NameQualityExplicit )
type Receipt ¶
type Receipt struct { RoomID id.RoomID UserID id.UserID ReceiptType event.ReceiptType ThreadID event.ThreadID EventID id.EventID Timestamp time.Time }
func (*Receipt) GetMassInsertValues ¶
type ReceiptQuery ¶
type ReceiptQuery struct { *dbutil.QueryHelper[*Receipt] }
type Room ¶
type Room struct { ID id.RoomID `json:"room_id"` CreationContent *event.CreateEventContent `json:"creation_content,omitempty"` Name *string `json:"name,omitempty"` NameQuality NameQuality `json:"name_quality"` Avatar *id.ContentURI `json:"avatar,omitempty"` Topic *string `json:"topic,omitempty"` CanonicalAlias *id.RoomAlias `json:"canonical_alias,omitempty"` LazyLoadSummary *mautrix.LazyLoadSummary `json:"lazy_load_summary,omitempty"` EncryptionEvent *event.EncryptionEventContent `json:"encryption_event,omitempty"` HasMemberList bool `json:"has_member_list"` PreviewEventRowID EventRowID `json:"preview_event_rowid"` SortingTimestamp time.Time `json:"sorting_timestamp"` PrevBatch string `json:"prev_batch"` }
func (*Room) BumpSortingTimestamp ¶
func (*Room) CheckChangesAndCopyInto ¶
type RoomQuery ¶
type RoomQuery struct { *dbutil.QueryHelper[*Room] }
func (*RoomQuery) SetPrevBatch ¶
func (*RoomQuery) UpdatePreviewIfLaterOnTimeline ¶
type SessionRequest ¶
type SessionRequest struct { RoomID id.RoomID SessionID id.SessionID Sender id.UserID MinIndex uint32 BackupChecked bool RequestSent bool }
func (*SessionRequest) Scan ¶
func (s *SessionRequest) Scan(row dbutil.Scannable) (*SessionRequest, error)
type SessionRequestQuery ¶
type SessionRequestQuery struct { *dbutil.QueryHelper[*SessionRequest] }
func (*SessionRequestQuery) Next ¶
func (srq *SessionRequestQuery) Next(ctx context.Context, count int) ([]*SessionRequest, error)
func (*SessionRequestQuery) Put ¶
func (srq *SessionRequestQuery) Put(ctx context.Context, sr *SessionRequest) error
type TimelineQuery ¶
type TimelineQuery struct { *dbutil.QueryHelper[*Event] // contains filtered or unexported fields }
func (*TimelineQuery) Append ¶
func (tq *TimelineQuery) Append(ctx context.Context, roomID id.RoomID, rowIDs []EventRowID) ([]TimelineRowTuple, error)
Append adds the given event row IDs to the end of the timeline.
func (*TimelineQuery) Get ¶
func (tq *TimelineQuery) Get(ctx context.Context, roomID id.RoomID, limit int, before TimelineRowID) ([]*Event, error)
func (*TimelineQuery) Prepend ¶
func (tq *TimelineQuery) Prepend(ctx context.Context, roomID id.RoomID, rowIDs []EventRowID) (prependEntries []TimelineRowTuple, err error)
Prepend adds the given event row IDs to the beginning of the timeline. The events must be sorted in reverse chronological order (newest event first).
type TimelineRowID ¶
type TimelineRowID int64
type TimelineRowTuple ¶
type TimelineRowTuple struct { Timeline TimelineRowID `json:"timeline_rowid"` Event EventRowID `json:"event_rowid"` }
func (TimelineRowTuple) GetMassInsertValues ¶
func (trt TimelineRowTuple) GetMassInsertValues() [2]any
Source Files ¶
Click to show internal directories.
Click to hide internal directories.