mirror of
https://git.asonix.dog/asonix/pict-rs.git
synced 2024-11-28 20:41:00 +00:00
postgres: Enable 'previous page' when less than full limit fit on previous page
This commit is contained in:
parent
e961bdc331
commit
00aa00c55c
1 changed files with 4 additions and 4 deletions
|
@ -354,11 +354,11 @@ impl HashRepo for PostgresRepo {
|
||||||
.or_filter(created_at.eq(timestamp).and(hash.gt(&bound_hash)))
|
.or_filter(created_at.eq(timestamp).and(hash.gt(&bound_hash)))
|
||||||
.order(created_at)
|
.order(created_at)
|
||||||
.then_order_by(hash)
|
.then_order_by(hash)
|
||||||
.offset(limit.saturating_sub(1) as i64)
|
.limit(limit as i64)
|
||||||
.first::<Hash>(&mut conn)
|
.get_results::<Hash>(&mut conn)
|
||||||
.await
|
.await
|
||||||
.optional()
|
.map_err(PostgresError::Diesel)?
|
||||||
.map_err(PostgresError::Diesel)?;
|
.pop();
|
||||||
|
|
||||||
(page, prev)
|
(page, prev)
|
||||||
} else {
|
} else {
|
||||||
|
|
Loading…
Reference in a new issue