Struct sea_query::query::WindowStatement
source ยท pub struct WindowStatement { /* private fields */ }
Expand description
Implementationsยง
sourceยงimpl WindowStatement
impl WindowStatement
sourcepub fn new() -> Self
pub fn new() -> Self
Construct a new WindowStatement
pub fn take(&mut self) -> Self
sourcepub fn partition_by<T>(col: T) -> Selfwhere
T: IntoColumnRef,
pub fn partition_by<T>(col: T) -> Selfwhere
T: IntoColumnRef,
Construct a new WindowStatement
with PARTITION BY column
sourcepub fn partition_by_custom<T>(col: T) -> Selfwhere
T: ToString,
pub fn partition_by_custom<T>(col: T) -> Selfwhere
T: ToString,
Construct a new WindowStatement
with PARTITION BY custom
sourcepub fn order_by<T>(col: T, order: Order) -> Selfwhere
T: IntoColumnRef,
pub fn order_by<T>(col: T, order: Order) -> Selfwhere
T: IntoColumnRef,
Construct a new WindowStatement
with ORDER BY column
sourcepub fn order_by_custom<T>(col: T, order: Order) -> Selfwhere
T: ToString,
pub fn order_by_custom<T>(col: T, order: Order) -> Selfwhere
T: ToString,
Construct a new WindowStatement
with ORDER BY custom
sourcepub fn frame_start(&mut self, type: FrameType, start: Frame) -> &mut Self
pub fn frame_start(&mut self, type: FrameType, start: Frame) -> &mut Self
frame clause for frame_start
Examples:
use sea_query::{tests_cfg::*, *};
let query = Query::select()
.from(Char::Table)
.expr_window_as(
Expr::col(Char::Character),
WindowStatement::partition_by(Char::FontSize)
.frame_start(FrameType::Rows, Frame::UnboundedPreceding)
.take(),
Alias::new("C"))
.to_owned();
assert_eq!(
query.to_string(MysqlQueryBuilder),
r#"SELECT `character` OVER ( PARTITION BY `font_size` ROWS UNBOUNDED PRECEDING ) AS `C` FROM `character`"#
);
assert_eq!(
query.to_string(PostgresQueryBuilder),
r#"SELECT "character" OVER ( PARTITION BY "font_size" ROWS UNBOUNDED PRECEDING ) AS "C" FROM "character""#
);
assert_eq!(
query.to_string(SqliteQueryBuilder),
r#"SELECT "character" OVER ( PARTITION BY "font_size" ROWS UNBOUNDED PRECEDING ) AS "C" FROM "character""#
);
sourcepub fn frame_between(
&mut self,
type: FrameType,
start: Frame,
end: Frame
) -> &mut Self
pub fn frame_between(
&mut self,
type: FrameType,
start: Frame,
end: Frame
) -> &mut Self
frame clause for BETWEEN frame_start AND frame_end
Examples:
use sea_query::{tests_cfg::*, *};
let query = Query::select()
.from(Char::Table)
.expr_window_as(
Expr::col(Char::Character),
WindowStatement::partition_by(Char::FontSize)
.frame_between(FrameType::Rows, Frame::UnboundedPreceding, Frame::UnboundedFollowing)
.take(),
Alias::new("C"))
.to_owned();
assert_eq!(
query.to_string(MysqlQueryBuilder),
r#"SELECT `character` OVER ( PARTITION BY `font_size` ROWS BETWEEN UNBOUNDED PRECEDING AND UNBOUNDED FOLLOWING ) AS `C` FROM `character`"#
);
assert_eq!(
query.to_string(PostgresQueryBuilder),
r#"SELECT "character" OVER ( PARTITION BY "font_size" ROWS BETWEEN UNBOUNDED PRECEDING AND UNBOUNDED FOLLOWING ) AS "C" FROM "character""#
);
assert_eq!(
query.to_string(SqliteQueryBuilder),
r#"SELECT "character" OVER ( PARTITION BY "font_size" ROWS BETWEEN UNBOUNDED PRECEDING AND UNBOUNDED FOLLOWING ) AS "C" FROM "character""#
);
Trait Implementationsยง
sourceยงimpl Clone for WindowStatement
impl Clone for WindowStatement
sourceยงfn clone(&self) -> WindowStatement
fn clone(&self) -> WindowStatement
Returns a copy of the value. Read more
1.0.0 ยท sourceยงfn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source
. Read moresourceยงimpl Debug for WindowStatement
impl Debug for WindowStatement
sourceยงimpl Default for WindowStatement
impl Default for WindowStatement
sourceยงfn default() -> WindowStatement
fn default() -> WindowStatement
Returns the โdefault valueโ for a type. Read more
sourceยงimpl OrderedStatement for WindowStatement
impl OrderedStatement for WindowStatement
sourceยงfn clear_order_by(&mut self) -> &mut Self
fn clear_order_by(&mut self) -> &mut Self
Clear order expressions
sourceยงfn order_by<T>(&mut self, col: T, order: Order) -> &mut Selfwhere
T: IntoColumnRef,
fn order_by<T>(&mut self, col: T, order: Order) -> &mut Selfwhere
T: IntoColumnRef,
Order by column. Read more
sourceยงfn order_by_expr(&mut self, expr: SimpleExpr, order: Order) -> &mut Self
fn order_by_expr(&mut self, expr: SimpleExpr, order: Order) -> &mut Self
Order by
SimpleExpr
.sourceยงfn order_by_customs<I, T>(&mut self, cols: I) -> &mut Selfwhere
T: ToString,
I: IntoIterator<Item = (T, Order)>,
fn order_by_customs<I, T>(&mut self, cols: I) -> &mut Selfwhere
T: ToString,
I: IntoIterator<Item = (T, Order)>,
Order by custom string.
sourceยงfn order_by_columns<I, T>(&mut self, cols: I) -> &mut Selfwhere
T: IntoColumnRef,
I: IntoIterator<Item = (T, Order)>,
fn order_by_columns<I, T>(&mut self, cols: I) -> &mut Selfwhere
T: IntoColumnRef,
I: IntoIterator<Item = (T, Order)>,
Order by vector of columns.
sourceยงfn order_by_with_nulls<T>(
&mut self,
col: T,
order: Order,
nulls: NullOrdering
) -> &mut Selfwhere
T: IntoColumnRef,
fn order_by_with_nulls<T>(
&mut self,
col: T,
order: Order,
nulls: NullOrdering
) -> &mut Selfwhere
T: IntoColumnRef,
Order by column with nulls order option. Read more
sourceยงfn order_by_expr_with_nulls(
&mut self,
expr: SimpleExpr,
order: Order,
nulls: NullOrdering
) -> &mut Self
fn order_by_expr_with_nulls(
&mut self,
expr: SimpleExpr,
order: Order,
nulls: NullOrdering
) -> &mut Self
Order by
SimpleExpr
with nulls order option.sourceยงfn order_by_customs_with_nulls<I, T>(&mut self, cols: I) -> &mut Selfwhere
T: ToString,
I: IntoIterator<Item = (T, Order, NullOrdering)>,
fn order_by_customs_with_nulls<I, T>(&mut self, cols: I) -> &mut Selfwhere
T: ToString,
I: IntoIterator<Item = (T, Order, NullOrdering)>,
Order by custom string with nulls order option.
sourceยงfn order_by_columns_with_nulls<I, T>(&mut self, cols: I) -> &mut Selfwhere
T: IntoColumnRef,
I: IntoIterator<Item = (T, Order, NullOrdering)>,
fn order_by_columns_with_nulls<I, T>(&mut self, cols: I) -> &mut Selfwhere
T: IntoColumnRef,
I: IntoIterator<Item = (T, Order, NullOrdering)>,
Order by vector of columns with nulls order option.
sourceยงimpl OverStatement for WindowStatement
impl OverStatement for WindowStatement
sourceยงfn partition_by<T>(&mut self, col: T) -> &mut Selfwhere
T: IntoColumnRef,
fn partition_by<T>(&mut self, col: T) -> &mut Selfwhere
T: IntoColumnRef,
Partition by column.
sourceยงfn partition_by_customs<I, T>(&mut self, cols: I) -> &mut Selfwhere
T: ToString,
I: IntoIterator<Item = T>,
fn partition_by_customs<I, T>(&mut self, cols: I) -> &mut Selfwhere
T: ToString,
I: IntoIterator<Item = T>,
Partition by custom string.
sourceยงfn partition_by_columns<I, T>(&mut self, cols: I) -> &mut Selfwhere
T: IntoColumnRef,
I: IntoIterator<Item = T>,
fn partition_by_columns<I, T>(&mut self, cols: I) -> &mut Selfwhere
T: IntoColumnRef,
I: IntoIterator<Item = T>,
Partition by vector of columns.