(db: &DatabaseConnection)
| 17 | } |
| 18 | |
| 19 | pub async fn create_insert_default(db: &DatabaseConnection) -> Result<(), DbErr> { |
| 20 | use insert_default::*; |
| 21 | |
| 22 | let active_model = ActiveModel { |
| 23 | ..Default::default() |
| 24 | }; |
| 25 | |
| 26 | active_model.clone().insert(db).await?; |
| 27 | active_model.clone().insert(db).await?; |
| 28 | active_model.insert(db).await?; |
| 29 | |
| 30 | assert_eq!( |
| 31 | Entity::find().all(db).await?, |
| 32 | [Model { id: 1 }, Model { id: 2 }, Model { id: 3 }] |
| 33 | ); |
| 34 | |
| 35 | Ok(()) |
| 36 | } |