mirror of
https://github.com/hoernschen/dendrite.git
synced 2025-08-02 22:22:46 +00:00
Add QueryStateAndAuthChainIDs
This commit is contained in:
parent
1827dd7c09
commit
90dd5e6544
8 changed files with 175 additions and 0 deletions
|
@ -292,6 +292,22 @@ func (d *Database) StateEntries(
|
|||
return lists, nil
|
||||
}
|
||||
|
||||
func (d *Database) AuthEventNIDs(
|
||||
ctx context.Context, events []types.EventNID,
|
||||
) (types.EventNIDs, error) {
|
||||
entries, err := d.EventsTable.SelectEventAuthEventNIDs(
|
||||
ctx, events,
|
||||
)
|
||||
if err != nil {
|
||||
return nil, fmt.Errorf("d.EventsTable.SelectEventAuthEventNIDs: %w", err)
|
||||
}
|
||||
var lists types.EventNIDs
|
||||
for _, nids := range entries {
|
||||
lists = append(lists, nids...)
|
||||
}
|
||||
return lists[:util.SortAndUnique(lists)], nil
|
||||
}
|
||||
|
||||
func (d *Database) SetRoomAlias(ctx context.Context, alias string, roomID string, creatorUserID string) error {
|
||||
return d.Writer.Do(d.DB, nil, func(txn *sql.Tx) error {
|
||||
return d.RoomAliasesTable.InsertRoomAlias(ctx, txn, alias, roomID, creatorUserID)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue