Offset allows you to skip a certain number of records before returning the result. This can be useful when requesting the next page of records if a limit is set.
Example
pub fn article_list(limit: i32, offset: i32, conn: &Connection) -> Result<Vec<ArticleOutput>, Error>
{
let res = Query::<Article>::new("article")
.limit(limit)
.offset(offset)
.load(conn);
match res {
Ok(articles) => {
let mut result : Vec<ArticleOutput> = vec!();
for article in articles {
result.push(article.to_result(conn));
}
Ok(result)
},
Err(err) => return Err(err)
}
}
Offset allows you to skip a certain number of records before returning the result. This can be useful when requesting the next page of records if a limit is set.
Example