From 0da4dede529b6500c2717124521c0e54c27a5bba Mon Sep 17 00:00:00 2001 From: Tulir Asokan Date: Sun, 26 Jan 2025 21:17:59 +0200 Subject: [PATCH] hicli/database: add get members method --- pkg/hicli/database/state.go | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/pkg/hicli/database/state.go b/pkg/hicli/database/state.go index f7f53eb..a703e65 100644 --- a/pkg/hicli/database/state.go +++ b/pkg/hicli/database/state.go @@ -39,6 +39,7 @@ const ( ` getCurrentRoomStateQuery = getCurrentRoomStateBaseQuery + `WHERE cs.room_id = $1` getCurrentRoomStateWithoutMembersQuery = getCurrentRoomStateBaseQuery + `WHERE cs.room_id = $1 AND type<>'m.room.member'` + getCurrentRoomStateMembersQuery = getCurrentRoomStateBaseQuery + `WHERE cs.room_id = $1 AND type='m.room.member'` getManyCurrentRoomStateQuery = getCurrentRoomStateBaseQuery + `WHERE (cs.room_id, cs.event_type, cs.state_key) IN (%s)` getCurrentStateEventQuery = getCurrentRoomStateBaseQuery + `WHERE cs.room_id = $1 AND cs.event_type = $2 AND cs.state_key = $3` ) @@ -118,3 +119,7 @@ func (csq *CurrentStateQuery) GetAll(ctx context.Context, roomID id.RoomID) ([]* func (csq *CurrentStateQuery) GetAllExceptMembers(ctx context.Context, roomID id.RoomID) ([]*Event, error) { return csq.QueryMany(ctx, getCurrentRoomStateWithoutMembersQuery, roomID) } + +func (csq *CurrentStateQuery) GetMembers(ctx context.Context, roomID id.RoomID) ([]*Event, error) { + return csq.QueryMany(ctx, getCurrentRoomStateMembersQuery, roomID) +}