Tweaks & fmt

This commit is contained in:
Chris Tsang 2022-07-11 00:03:40 +08:00
parent c18a204f78
commit a24df5a91e
2 changed files with 11 additions and 17 deletions

View File

@ -166,7 +166,10 @@ impl Column {
pub fn get_info(&self) -> String { pub fn get_info(&self) -> String {
let mut info = String::new(); let mut info = String::new();
let type_info = self.get_rs_type(&DateTimeCrate::Chrono).to_string().replace(' ', ""); let type_info = self
.get_rs_type(&DateTimeCrate::Chrono)
.to_string()
.replace(' ', "");
let col_info = self.col_info(); let col_info = self.col_info();
write!( write!(
&mut info, &mut info,

View File

@ -372,23 +372,14 @@ where
self.into_model().stream(db).await self.into_model().stream(db).await
} }
/// `SelectTwoMany::one()` method is being dropped:
/// `SelectTwoMany` is for selecting models of a one-to-many relationship
/// but `SelectTwoMany::one()` returns `Option<(E, Option<F>)>`
/// and the return value is a pair of models instead of `(E, Vec<F>)`
/// which is a weird query result for a one-to-many relationship.
///
/// Users are advised to query `(E, Vec<F>)` by first querying `E` from the database,
/// then use `find_related` method to query `Vec<F>`.
/// Read https://www.sea-ql.org/SeaORM/docs/basic-crud/select#lazy-loading for details.
// pub async fn one<'a, C>(self, db: &C) -> Result<Option<(E::Model, Option<F::Model>)>, DbErr>
// where
// C: ConnectionTrait,
// {
// self.into_model().one(db).await
// }
/// Get all Models from the select operation /// Get all Models from the select operation
///
/// > `SelectTwoMany::one()` method has been dropped (#486)
/// >
/// > You can get `(Entity, Vec<RelatedEntity>)` by first querying a single model from Entity,
/// > then use [`ModelTrait::find_related`] on the model.
/// >
/// > See https://www.sea-ql.org/SeaORM/docs/basic-crud/select#lazy-loading for details.
pub async fn all<'a, C>(self, db: &C) -> Result<Vec<(E::Model, Vec<F::Model>)>, DbErr> pub async fn all<'a, C>(self, db: &C) -> Result<Vec<(E::Model, Vec<F::Model>)>, DbErr>
where where
C: ConnectionTrait, C: ConnectionTrait,