add database.getRoom
This commit is contained in:
parent
5a57c886ae
commit
1a9f6e38dc
|
@ -5406,6 +5406,29 @@ abstract class _$Database extends GeneratedDatabase {
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
DbRoom _rowToDbRoom(QueryRow row) {
|
||||||
|
return DbRoom(
|
||||||
|
clientId: row.readInt('client_id'),
|
||||||
|
roomId: row.readString('room_id'),
|
||||||
|
membership: row.readString('membership'),
|
||||||
|
highlightCount: row.readInt('highlight_count'),
|
||||||
|
notificationCount: row.readInt('notification_count'),
|
||||||
|
prevBatch: row.readString('prev_batch'),
|
||||||
|
joinedMemberCount: row.readInt('joined_member_count'),
|
||||||
|
invitedMemberCount: row.readInt('invited_member_count'),
|
||||||
|
newestSortOrder: row.readDouble('newest_sort_order'),
|
||||||
|
oldestSortOrder: row.readDouble('oldest_sort_order'),
|
||||||
|
heroes: row.readString('heroes'),
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
Selectable<DbRoom> getRoom(int client_id, String room_id) {
|
||||||
|
return customSelect(
|
||||||
|
'SELECT * FROM rooms WHERE client_id = :client_id AND room_id = :room_id',
|
||||||
|
variables: [Variable.withInt(client_id), Variable.withString(room_id)],
|
||||||
|
readsFrom: {rooms}).map(_rowToDbRoom);
|
||||||
|
}
|
||||||
|
|
||||||
Selectable<DbEvent> getEvent(int client_id, String event_id, String room_id) {
|
Selectable<DbEvent> getEvent(int client_id, String event_id, String room_id) {
|
||||||
return customSelect(
|
return customSelect(
|
||||||
'SELECT * FROM events WHERE client_id = :client_id AND event_id = :event_id AND room_id = :room_id',
|
'SELECT * FROM events WHERE client_id = :client_id AND event_id = :event_id AND room_id = :room_id',
|
||||||
|
|
|
@ -190,6 +190,7 @@ dbGetUser: SELECT * FROM room_states WHERE client_id = :client_id AND type = 'm.
|
||||||
dbGetEventList: SELECT * FROM events WHERE client_id = :client_id AND room_id = :room_id GROUP BY event_id ORDER BY sort_order DESC;
|
dbGetEventList: SELECT * FROM events WHERE client_id = :client_id AND room_id = :room_id GROUP BY event_id ORDER BY sort_order DESC;
|
||||||
getStates: SELECT * FROM room_states WHERE client_id = :client_id AND room_id = :room_id;
|
getStates: SELECT * FROM room_states WHERE client_id = :client_id AND room_id = :room_id;
|
||||||
resetNotificationCount: UPDATE rooms SET notification_count = 0, highlight_count = 0 WHERE client_id = :client_id AND room_id = :room_id;
|
resetNotificationCount: UPDATE rooms SET notification_count = 0, highlight_count = 0 WHERE client_id = :client_id AND room_id = :room_id;
|
||||||
|
getRoom: SELECT * FROM rooms WHERE client_id = :client_id AND room_id = :room_id;
|
||||||
getEvent: SELECT * FROM events WHERE client_id = :client_id AND event_id = :event_id AND room_id = :room_id;
|
getEvent: SELECT * FROM events WHERE client_id = :client_id AND event_id = :event_id AND room_id = :room_id;
|
||||||
removeEvent: DELETE FROM events WHERE client_id = :client_id AND event_id = :event_id AND room_id = :room_id;
|
removeEvent: DELETE FROM events WHERE client_id = :client_id AND event_id = :event_id AND room_id = :room_id;
|
||||||
removeRoom: DELETE FROM rooms WHERE client_id = :client_id AND room_id = :room_id;
|
removeRoom: DELETE FROM rooms WHERE client_id = :client_id AND room_id = :room_id;
|
||||||
|
|
Loading…
Reference in a new issue