chatItemsAroundBottomless method
- String chatId,
- PreciseDateTime at,
- double before
inherited
Implementation
Selectable<ChatItemsAroundBottomlessResult> chatItemsAroundBottomless(
String chatId,
PreciseDateTime at,
double before,
) {
return customSelect(
'SELECT * FROM (SELECT * FROM chat_item_views INNER JOIN chat_items ON chat_items.id = chat_item_views.chat_item_id WHERE chat_item_views.chat_id = ?1 AND at <= ?2 ORDER BY at DESC LIMIT ?3 + 1) AS a UNION SELECT * FROM (SELECT * FROM chat_item_views INNER JOIN chat_items ON chat_items.id = chat_item_views.chat_item_id WHERE chat_item_views.chat_id = ?1 AND at > ?2 ORDER BY at ASC) AS b ORDER BY at ASC',
variables: [
Variable<String>(chatId),
Variable<int>($ChatItemsTable.$converterat.toSql(at)),
Variable<double>(before),
],
readsFrom: {chatItemViews, chatItems},
).map(
(QueryRow row) => ChatItemsAroundBottomlessResult(
chatId: row.read<String>('chat_id'),
chatItemId: row.read<String>('chat_item_id'),
id: row.read<String>('id'),
chatId1: row.read<String>('chat_id'),
authorId: row.read<String>('author_id'),
at: $ChatItemsTable.$converterat.fromSql(row.read<int>('at')),
status: $ChatItemsTable.$converterstatus.fromSql(
row.read<int>('status'),
),
data: row.read<String>('data'),
cursor: row.readNullable<String>('cursor'),
ver: row.read<String>('ver'),
),
);
}