Skip to main content

limit_offset

Function limit_offset 

Source
pub fn limit_offset(req: &OffsetPageRequest) -> (i64, i64)
Expand description

Return (limit, offset) as i64 values ready to bind to a parameterised query:

let (limit, offset) = limit_offset(&req);
let rows = sqlx::query("SELECT * FROM users LIMIT $1 OFFSET $2")
    .bind(limit)
    .bind(offset)
    .fetch_all(&pool)
    .await?;