Add a select column with alias ``` use sea_orm::{entity::*, query::*, tests_cfg::cake, DbBackend}; assert_eq!( cake::Entity::find() .select_only() .column_as(cake::Column::Id.count(), "count") .build(DbBackend::Postgres) .to_string(), r#"SELECT COUNT("cake"."id") AS "count" FROM "cake""# ); ```
(mut self, col: C, alias: I)
| 85 | /// ); |
| 86 | /// ``` |
| 87 | fn column_as<C, I>(mut self, col: C, alias: I) -> Self |
| 88 | where |
| 89 | C: ColumnAsExpr, |
| 90 | I: IntoIdentity, |
| 91 | { |
| 92 | self.query().expr(SelectExpr { |
| 93 | expr: col.into_column_as_expr(), |
| 94 | alias: Some(SeaRc::new(alias.into_identity())), |
| 95 | window: None, |
| 96 | }); |
| 97 | self |
| 98 | } |
| 99 | |
| 100 | /// Select columns |
| 101 | /// |