Implement limit

This commit is contained in:
Mikhail 2024-05-28 20:59:42 +02:00
parent b0789d5457
commit 1e8a183d6c
1 changed files with 19 additions and 14 deletions

View File

@ -34,6 +34,9 @@ impl Storage {
let mut executor = self.conn.lock().await; let mut executor = self.conn.lock().await;
let res = sqlx::query_as( let res = sqlx::query_as(
" "
select
*
from (
select select
messages.id as id, messages.id as id,
content, content,
@ -47,10 +50,12 @@ impl Storage {
where where
room_id = ? room_id = ?
order by order by
messages.id messages.id desc
limit ?; limit ?
)
order by
id asc;
", ",
// todo: implement limit
) )
.bind(room_id) .bind(room_id)
.bind(limit) .bind(limit)