()
| 187 | |
| 188 | #[sea_orm_macros::test] |
| 189 | pub async fn select_only_exclude_option_fields() { |
| 190 | let ctx = TestContext::new("select_only_exclude_option_fields").await; |
| 191 | create_tables(&ctx.db).await.unwrap(); |
| 192 | |
| 193 | let _ = customer::ActiveModel { |
| 194 | name: Set("Alice".to_owned()), |
| 195 | notes: Set(Some("Want to communicate with Bob".to_owned())), |
| 196 | ..Default::default() |
| 197 | } |
| 198 | .save(&ctx.db) |
| 199 | .await |
| 200 | .expect("could not insert customer"); |
| 201 | |
| 202 | let _ = customer::ActiveModel { |
| 203 | name: Set("Bob".to_owned()), |
| 204 | notes: Set(Some("Just listening".to_owned())), |
| 205 | ..Default::default() |
| 206 | } |
| 207 | .save(&ctx.db) |
| 208 | .await |
| 209 | .expect("could not insert customer"); |
| 210 | |
| 211 | let customers = Customer::find() |
| 212 | .select_only() |
| 213 | .column(customer::Column::Id) |
| 214 | .column(customer::Column::Name) |
| 215 | .all(&ctx.db) |
| 216 | .await |
| 217 | .unwrap(); |
| 218 | |
| 219 | assert_eq!(customers.len(), 2); |
| 220 | assert_eq!(customers[0].notes, None); |
| 221 | assert_eq!(customers[1].notes, None); |
| 222 | |
| 223 | ctx.delete().await; |
| 224 | } |
nothing calls this directly
no test coverage detected