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

Method limit

src/query/helper.rs:240–250  ·  view source on GitHub ↗

Add a limit expression. Passing in None would remove the limit. ``` use sea_orm::{entity::*, query::*, tests_cfg::cake, DbBackend}; assert_eq!( cake::Entity::find() .limit(10) .build(DbBackend::MySql) .to_string(), "SELECT `cake`.`id`, `cake`.`name` FROM `cake` LIMIT 10" ); assert_eq!( cake::Entity::find() .limit(Some(10)) .limit(Some(20)) .build(DbBackend::MySql) .to_string(), "SELECT `cake`.`

(mut self, limit: T)

Source from the content-addressed store, hash-verified

238 /// );
239 /// ```
240 fn limit<T>(mut self, limit: T) -> Self
241 where
242 T: Into<Option<u64>>,
243 {
244 if let Some(limit) = limit.into() {
245 self.query().limit(limit);
246 } else {
247 self.query().reset_limit();
248 }
249 self
250 }
251
252 /// Add a group by column
253 /// ```

Callers 14

oneMethod · 0.80
fetch_pageMethod · 0.80
existsMethod · 0.80
fetch_pageFunction · 0.80
fetch_page_rawFunction · 0.80
fetchFunction · 0.80
fetch_rawFunction · 0.80
fetch_and_nextFunction · 0.80
fetch_and_next_rawFunction · 0.80
into_streamFunction · 0.80
into_stream_rawFunction · 0.80

Implementers 1

cursor.rssrc/executor/cursor.rs

Calls 1

queryMethod · 0.45

Tested by 1

exists_with_limit_offsetFunction · 0.64