forked from lavina/lavina
Implement limit
This commit is contained in:
parent
b0789d5457
commit
1e8a183d6c
|
@ -35,22 +35,27 @@ impl Storage {
|
||||||
let res = sqlx::query_as(
|
let res = sqlx::query_as(
|
||||||
"
|
"
|
||||||
select
|
select
|
||||||
messages.id as id,
|
*
|
||||||
content,
|
from (
|
||||||
created_at,
|
select
|
||||||
users.name as author_name
|
messages.id as id,
|
||||||
from
|
content,
|
||||||
messages
|
created_at,
|
||||||
join
|
users.name as author_name
|
||||||
users
|
from
|
||||||
on messages.author_id = users.id
|
messages
|
||||||
where
|
join
|
||||||
room_id = ?
|
users
|
||||||
|
on messages.author_id = users.id
|
||||||
|
where
|
||||||
|
room_id = ?
|
||||||
|
order by
|
||||||
|
messages.id desc
|
||||||
|
limit ?
|
||||||
|
)
|
||||||
order by
|
order by
|
||||||
messages.id
|
id asc;
|
||||||
limit ?;
|
|
||||||
",
|
",
|
||||||
// todo: implement limit
|
|
||||||
)
|
)
|
||||||
.bind(room_id)
|
.bind(room_id)
|
||||||
.bind(limit)
|
.bind(limit)
|
||||||
|
|
Loading…
Reference in New Issue