pub struct Page { /* private fields */ }
Expand description

The struct used to perform pagination

Implementations

Create a new Page.

smaller: Controls the direction of the pagination.

  • true: Select the rows towards the direction in which the cursor becomes smaller. The returned rows will be sorted desc.
  • false: Select the rows towards the direction in which the cursor becomes bigger. The returned rows will be sorted asc.

For example, if the sorting columns are (time_of_insertion, table_pkey), and you want to scroll to the past, you should set smaller = true.

size: Size of the page.

columns: Sort rows using these columns (up to 5). Note that the joint of these columns should uniquely identifies a row.

Push the pagination condition to the builder: QueryBuilder.

Roughly, push_whereN pushes and binds (col_1, col_2, ..., col_N) op ($_, $_, ..., $_) to the builder, where op is chosen according to the pagination direction, and N is the number of cursor columns.

Note, internally this calls builder::push/push_bind, so it is as secure as the QueryBuilder.

Push the order by clause order by (col_1, ...) asc/desc.

Push the limit clause limit k.

Auto Trait Implementations

Blanket Implementations

Gets the TypeId of self. Read more

Immutably borrows from an owned value. Read more

Mutably borrows from an owned value. Read more

Returns the argument unchanged.

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Should always be Self

The type returned in the event of a conversion error.

Performs the conversion.

The type returned in the event of a conversion error.

Performs the conversion.