MCPcopy Create free account
hub / github.com/SeaQL/sea-orm / fetch_page

Method fetch_page

src/executor/paginator.rs:44–60  ·  view source on GitHub ↗

Fetch a specific page; page index starts from zero

(&self, page: u64)

Source from the content-addressed store, hash-verified

42{
43 /// Fetch a specific page; page index starts from zero
44 pub async fn fetch_page(&self, page: u64) -> Result<Vec<S::Item>, DbErr> {
45 let query = self
46 .query
47 .clone()
48 .limit(self.page_size)
49 .offset(self.page_size * page)
50 .to_owned();
51 let builder = self.db.get_database_backend();
52 let stmt = builder.build(&query);
53 let rows = self.db.query_all(stmt).await?;
54 let mut buffer = Vec::with_capacity(rows.len());
55 for row in rows.into_iter() {
56 // TODO: Error handling
57 buffer.push(S::from_raw_query_result(row)?);
58 }
59 Ok(buffer)
60 }
61
62 /// Fetch the current page
63 pub async fn fetch(&self) -> Result<Vec<S::Item>, DbErr> {

Callers 11

fetchMethod · 0.80
find_posts_in_pageMethod · 0.80
find_posts_in_pageMethod · 0.80
find_notes_in_pageMethod · 0.80
find_posts_in_pageMethod · 0.80
find_posts_in_pageMethod · 0.80
find_first_pageFunction · 0.80
find_posts_in_pageMethod · 0.80
find_posts_in_pageMethod · 0.80
find_posts_in_pageMethod · 0.80
find_posts_in_pageMethod · 0.80

Calls 7

offsetMethod · 0.80
limitMethod · 0.80
into_iterMethod · 0.80
pushMethod · 0.80
get_database_backendMethod · 0.45
buildMethod · 0.45
query_allMethod · 0.45

Tested by

no test coverage detected