pub trait SQLxPagination<DB, S>where
DB: Database,
for<'b> &'b mut DB::Connection: Executor<'b, Database = DB>,
for<'c> i64: Type<DB> + Decode<'c, DB>,
for<'d> DB::Arguments<'d>: IntoArguments<'d, DB>,
usize: ColumnIndex<DB::Row>,
S: for<'r> FromRow<'r, DB::Row> + Clone,{
// Required method
fn paginate(
&self,
conn: &mut DB::Connection,
page: usize,
size: usize,
) -> impl Future<Output = PaginationResult<Page<S>>>;
}Expand description
Required Methods§
Sourcefn paginate(
&self,
conn: &mut DB::Connection,
page: usize,
size: usize,
) -> impl Future<Output = PaginationResult<Page<S>>>
fn paginate( &self, conn: &mut DB::Connection, page: usize, size: usize, ) -> impl Future<Output = PaginationResult<Page<S>>>
Paginate results from a SQL query into a Page model from database using sqlx.
Available for Postgres, MySQL or SQLite databases.
§Arguments:
- conn: A mutable reference to a connection to the database.
- page: The page index.
- size: The number of records per page.
§Returns:
A PaginationResult containing a Page model of the paginated records S, where S must implement the FromRow for given Database::Row type according to the database.
Only available when the sqlx feature is enabled.
Dyn Compatibility§
This trait is not dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.