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

Method fetch_and_next

src/executor/paginator.rs:159–164  ·  view source on GitHub ↗

Fetch one page and increment the page counter ``` # use sea_orm::{error::*, tests_cfg::*, *}; # # #[smol_potat::main] # #[cfg(feature = "mock")] # pub async fn main() -> Result<(), DbErr> { # # let owned_db = MockDatabase::new(DbBackend::Postgres) # .append_query_results([ # vec![cake::Model { # id: 1, # name: "Cake".to_owned(), # }], # vec![],

(&mut self)

Source from the content-addressed store, hash-verified

157 /// # }
158 /// ```
159 pub async fn fetch_and_next(&mut self) -> Result<Option<Vec<S::Item>>, DbErr> {
160 let vec = self.fetch().await?;
161 self.next();
162 let opt = if !vec.is_empty() { Some(vec) } else { None };
163 Ok(opt)
164 }
165
166 /// Convert self into an async stream
167 ///

Callers 1

find_all_streamFunction · 0.80

Calls 2

nextMethod · 0.80
fetchMethod · 0.45

Tested by

no test coverage detected