add offset and limit (#351)
* add offset and limit * move offset&limit to QuerySelect
This commit is contained in:
parent
cc4904993a
commit
273dc0dd1a
@ -71,6 +71,40 @@ pub trait QuerySelect: Sized {
|
|||||||
self
|
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
|
/// Add a group by column
|
||||||
/// ```
|
/// ```
|
||||||
/// use sea_orm::{entity::*, query::*, tests_cfg::cake, DbBackend};
|
/// use sea_orm::{entity::*, query::*, tests_cfg::cake, DbBackend};
|
||||||
|
Loading…
x
Reference in New Issue
Block a user