mirror of
https://git.asonix.dog/asonix/pict-rs
synced 2024-12-22 03:11:24 +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)))
|
||||
.order(created_at)
|
||||
.then_order_by(hash)
|
||||
.offset(limit.saturating_sub(1) as i64)
|
||||
.first::<Hash>(&mut conn)
|
||||
.limit(limit as i64)
|
||||
.get_results::<Hash>(&mut conn)
|
||||
.await
|
||||
.optional()
|
||||
.map_err(PostgresError::Diesel)?;
|
||||
.map_err(PostgresError::Diesel)?
|
||||
.pop();
|
||||
|
||||
(page, prev)
|
||||
} else {
|
||||
|
|
Loading…
Reference in a new issue