cargo fmt
This commit is contained in:
parent
4323a0cb07
commit
6c7a162f05
@ -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(
|
id: 1,
|
||||||
cake::Model {
|
name: "New York Cheese".to_owned(),
|
||||||
id: 1,
|
})]
|
||||||
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![
|
||||||
|
@ -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::*;
|
|
||||||
|
@ -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");
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user