pub trait AliasExt: Sized {
// Provided methods
fn alias(self, name: &'static str) -> AliasedExpr<Self> { ... }
fn named<Name: Tag>(self) -> NamedExpr<Self, Name> { ... }
}Expand description
Method syntax for naming a selected expression.
.alias("name")sets a name at run time (AliasedExpr)..named::<Tag>()sets a name in the type (NamedExpr), so a derived table built from the query can refer to the column.
Implemented for every expression with a known Rust type. On raw SQL,
the inherent SQL::alias method is called instead and returns SQL.
§Examples
let n = count(users.id).alias("user_count");
assert_eq!(n.to_sql().sql(), r#"COUNT ("users"."id") AS "user_count""#);Provided Methods§
Sourcefn alias(self, name: &'static str) -> AliasedExpr<Self>
fn alias(self, name: &'static str) -> AliasedExpr<Self>
Renames this expression: expr AS "name".
Dyn Compatibility§
This trait is not dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety".