pub trait SelectExprTrait: Sized {
// Required methods
fn alias<A>(self, alias: A) -> SelectExpr
where A: IntoIden;
fn over(self, over_expr: impl Into<WindowSelectType>) -> SelectExpr;
}Expand description
Extension methods for building a SelectExpr from an expression.
This makes it ergonomic to attach select-specific modifiers (like AS and OVER) and pass the
result into SelectStatement::expr.
§Examples
use sea_query::{tests_cfg::*, *};
let query = Query::select()
.from(Char::Table)
.expr(
Expr::col(Char::Character)
.max()
.over(WindowStatement::partition_by(Char::FontSize))
.alias("C"),
)
.to_owned();
assert_eq!(
query.to_string(MysqlQueryBuilder),
r#"SELECT MAX(`character`) OVER ( PARTITION BY `font_size` ) AS `C` FROM `character`"#
);Required Methods§
fn alias<A>(self, alias: A) -> SelectExprwhere
A: IntoIden,
fn over(self, over_expr: impl Into<WindowSelectType>) -> SelectExpr
Dyn Compatibility§
This trait is not dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety".