(db: &DatabaseConnection)
| 169 | } |
| 170 | |
| 171 | pub async fn update_collection(db: &DatabaseConnection) -> Result<(), DbErr> { |
| 172 | use collection::*; |
| 173 | |
| 174 | let uuid = Uuid::new_v4(); |
| 175 | let model = Entity::find_by_id(1).one(db).await?.unwrap(); |
| 176 | |
| 177 | ActiveModel { |
| 178 | integers: Set(vec![4, 5, 6]), |
| 179 | integers_opt: Set(Some(vec![4, 5, 6])), |
| 180 | teas: Set(vec![Tea::EverydayTea]), |
| 181 | teas_opt: Set(Some(vec![Tea::EverydayTea])), |
| 182 | colors: Set(vec![Color::White]), |
| 183 | colors_opt: Set(Some(vec![Color::White])), |
| 184 | ..model.into_active_model() |
| 185 | } |
| 186 | .update(db) |
| 187 | .await?; |
| 188 | |
| 189 | ActiveModel { |
| 190 | id: Unchanged(3), |
| 191 | name: Set("Collection 3".into()), |
| 192 | integers: Set(vec![3, 1, 4]), |
| 193 | integers_opt: Set(None), |
| 194 | teas: Set(vec![Tea::EverydayTea]), |
| 195 | teas_opt: Set(None), |
| 196 | colors: Set(vec![Color::White]), |
| 197 | colors_opt: Set(None), |
| 198 | uuid: Set(vec![uuid]), |
| 199 | uuid_hyphenated: Set(vec![uuid.hyphenated()]), |
| 200 | } |
| 201 | .update(db) |
| 202 | .await?; |
| 203 | |
| 204 | Ok(()) |
| 205 | } |
| 206 | |
| 207 | pub async fn select_collection(db: &DatabaseConnection) -> Result<(), DbErr> { |
| 208 | use collection::*; |
no test coverage detected