cargo fmt

This commit is contained in:
Chris Tsang 2022-11-23 22:47:41 +08:00
parent 4323a0cb07
commit 6c7a162f05
3 changed files with 33 additions and 38 deletions

View File

@ -290,27 +290,25 @@ mod tests {
}; };
let db = MockDatabase::new(DbBackend::Postgres) let db = MockDatabase::new(DbBackend::Postgres)
.append_query_results(vec![ .append_query_results(vec![vec![
vec![
cake::Model { cake::Model {
id: 1, id: 1,
name: "New York Cheese".to_owned(), name: "New York Cheese".to_owned(),
}.into_mock_row(), }
.into_mock_row(),
cake::Model { cake::Model {
id: 2, id: 2,
name: "London Cheese".to_owned(), name: "London Cheese".to_owned(),
}.into_mock_row() }
], .into_mock_row(),
]) ]])
.into_connection(); .into_connection();
let fruits = vec![ let fruits = vec![fruit::Model {
fruit::Model {
id: 1, id: 1,
name: "Apple".to_owned(), name: "Apple".to_owned(),
cake_id: Some(1), cake_id: Some(1),
} }];
];
let cakes = fruits let cakes = fruits
.load_one(cake::Entity::find(), &db) .load_one(cake::Entity::find(), &db)
@ -319,14 +317,10 @@ mod tests {
assert_eq!( assert_eq!(
cakes, cakes,
vec![ vec![Some(cake::Model {
Some(
cake::Model {
id: 1, id: 1,
name: "New York Cheese".to_owned(), name: "New York Cheese".to_owned(),
} })]
)
]
); );
} }
@ -338,14 +332,12 @@ mod tests {
}; };
let db = MockDatabase::new(DbBackend::Postgres) let db = MockDatabase::new(DbBackend::Postgres)
.append_query_results(vec![ .append_query_results(vec![vec![fruit::Model {
vec![fruit::Model {
id: 1, id: 1,
name: "Apple".to_owned(), name: "Apple".to_owned(),
cake_id: Some(1), cake_id: Some(1),
} }
.into_mock_row()], .into_mock_row()]])
])
.into_connection(); .into_connection();
let cakes = vec![ let cakes = vec![

View File

@ -101,12 +101,12 @@ mod base_entity;
mod column; mod column;
mod identity; mod identity;
mod link; mod link;
mod loader;
mod model; mod model;
/// Re-export common types from the entity /// Re-export common types from the entity
pub mod prelude; pub mod prelude;
mod primary_key; mod primary_key;
mod relation; mod relation;
mod loader;
pub use active_enum::*; pub use active_enum::*;
pub use active_model::*; pub use active_model::*;
@ -116,6 +116,6 @@ pub use identity::*;
pub use link::*; pub use link::*;
pub use model::*; pub use model::*;
// pub use prelude::*; // pub use prelude::*;
pub use loader::*;
pub use primary_key::*; pub use primary_key::*;
pub use relation::*; pub use relation::*;
pub use loader::*;

View File

@ -141,7 +141,10 @@ async fn loader_load_many() -> Result<(), DbErr> {
.expect("Should load bakeries"); .expect("Should load bakeries");
let bakers = bakeries let bakers = bakeries
.load_many(baker::Entity::find().filter(baker::Column::Name.like("Baker%")), &ctx.db) .load_many(
baker::Entity::find().filter(baker::Column::Name.like("Baker%")),
&ctx.db,
)
.await .await
.expect("Should load bakers"); .expect("Should load bakers");