What
Pagination
is a page query lib for rust.
Usage
Build pageable request param
Only pagination params
use ;
let page_param = new;
let offset_param = page_param.into_offset;
assert_eq!;
assert_eq!;
Support complex params
use ;
let page_req = new;
let offset_req = page_req.into_offset;
assert_eq!;
assert_eq!;
Default page size
If the page size from user is 0
or greater than max page size
, the DEFAULT_PAGE_SIZE
will be the page size.
The value of DEFAULT_PAGE_SIZE
is 20
, and you can choose the value by the features, page-size-5
,page-size-10
,
page-size-15
, page-size-20
, page-size-30
,page-size-40
, page-size-50
.
Wrap the database result
use Page;
let page = new;
let f1 = page;
assert_eq!;
License
Licensed under either of these: