Changelog & Docs

This commit is contained in:
Chris Tsang 2023-01-26 23:36:16 +08:00
parent 4e1a0e4a7c
commit 5683c83189
2 changed files with 10 additions and 21 deletions

View File

@ -29,6 +29,7 @@ and this project adheres to [Semantic Versioning](http://semver.org/).
* Generate compact entity with `#[sea_orm(column_type = "JsonBinary")]` macro attribute https://github.com/SeaQL/sea-orm/pull/1346
* `MockDatabase::append_exec_results()`, `MockDatabase::append_query_results()`, `MockDatabase::append_exec_errors()` and `MockDatabase::append_query_errors()` take any types implemented `IntoIterator` trait https://github.com/SeaQL/sea-orm/pull/1367
* `find_by_id` and `delete_by_id` take any `Into` primary key value https://github.com/SeaQL/sea-orm/pull/1362
* `QuerySelect::offset` and `QuerySelect::limit` takes in `Into<Option<u64>>` where `None` would reset them https://github.com/SeaQL/sea-orm/pull/1410
* Added `DatabaseConnection::close` https://github.com/SeaQL/sea-orm/pull/1236
* Added `is_null` getter for `ColumnDef` https://github.com/SeaQL/sea-orm/pull/1381
* Added `ActiveValue::reset` to convert `Unchanged` into `Set` https://github.com/SeaQL/sea-orm/pull/1177

View File

@ -163,7 +163,8 @@ pub trait QuerySelect: Sized {
self
}
/// Add an offset expression
/// Add an offset expression. Passing in None would remove the offset.
///
/// ```
/// use sea_orm::{entity::*, query::*, tests_cfg::cake, DbBackend};
///
@ -178,23 +179,16 @@ pub trait QuerySelect: Sized {
/// assert_eq!(
/// cake::Entity::find()
/// .offset(Some(10))
/// .offset(Some(20))
/// .build(DbBackend::MySql)
/// .to_string(),
/// "SELECT `cake`.`id`, `cake`.`name` FROM `cake` OFFSET 10"
/// );
///
/// assert_eq!(
/// cake::Entity::find()
/// .offset(None)
/// .build(DbBackend::MySql)
/// .to_string(),
/// "SELECT `cake`.`id`, `cake`.`name` FROM `cake`"
/// "SELECT `cake`.`id`, `cake`.`name` FROM `cake` OFFSET 20"
/// );
///
/// assert_eq!(
/// cake::Entity::find()
/// .offset(10)
/// .offset(None) // This will reset the offset
/// .offset(None)
/// .build(DbBackend::MySql)
/// .to_string(),
/// "SELECT `cake`.`id`, `cake`.`name` FROM `cake`"
@ -212,7 +206,8 @@ pub trait QuerySelect: Sized {
self
}
/// Add a limit expression
/// Add a limit expression. Passing in None would remove the limit.
///
/// ```
/// use sea_orm::{entity::*, query::*, tests_cfg::cake, DbBackend};
///
@ -227,17 +222,10 @@ pub trait QuerySelect: Sized {
/// assert_eq!(
/// cake::Entity::find()
/// .limit(Some(10))
/// .limit(Some(20))
/// .build(DbBackend::MySql)
/// .to_string(),
/// "SELECT `cake`.`id`, `cake`.`name` FROM `cake` LIMIT 10"
/// );
///
/// assert_eq!(
/// cake::Entity::find()
/// .limit(None)
/// .build(DbBackend::MySql)
/// .to_string(),
/// "SELECT `cake`.`id`, `cake`.`name` FROM `cake`"
/// "SELECT `cake`.`id`, `cake`.`name` FROM `cake` LIMIT 20"
/// );
///
/// assert_eq!(