diff --git a/src/query/helper.rs b/src/query/helper.rs index 46f8c8959..ca51aae0a 100644 --- a/src/query/helper.rs +++ b/src/query/helper.rs @@ -71,6 +71,40 @@ pub trait QuerySelect: Sized { self } + /// Add an offset expression + /// ``` + /// use sea_orm::{entity::*, query::*, tests_cfg::cake, DbBackend}; + /// + /// assert_eq!( + /// cake::Entity::find() + /// .offset(10) + /// .build(DbBackend::MySql) + /// .to_string(), + /// "SELECT `cake`.`id`, `cake`.`name` FROM `cake` OFFSET 10" + /// ); + /// ``` + fn offset(mut self, offset: u64) -> Self { + self.query().offset(offset); + self + } + + /// Add a limit expression + /// ``` + /// 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" + /// ); + /// ``` + fn limit(mut self, limit: u64) -> Self { + self.query().limit(limit); + self + } + /// Add a group by column /// ``` /// use sea_orm::{entity::*, query::*, tests_cfg::cake, DbBackend};