Struct sea_query::query::WindowStatement
source · [−]pub struct WindowStatement { /* private fields */ }
Expand description
Implementations
sourceimpl 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) -> Self where
T: IntoColumnRef,
pub fn partition_by<T>(col: T) -> Self where
T: IntoColumnRef,
Construct a new WindowStatement
with PARTITION BY column
sourcepub fn partition_by_custom<T>(col: T) -> Self where
T: ToString,
pub fn partition_by_custom<T>(col: T) -> Self where
T: ToString,
Construct a new WindowStatement
with PARTITION BY custom
sourcepub fn order_by<T>(col: T, order: Order) -> Self where
T: IntoColumnRef,
pub fn order_by<T>(col: T, order: Order) -> Self where
T: IntoColumnRef,
Construct a new WindowStatement
with ORDER BY column
sourcepub fn order_by_custom<T>(col: T, order: Order) -> Self where
T: ToString,
pub fn order_by_custom<T>(col: T, order: Order) -> Self where
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
sourceimpl Clone for WindowStatement
impl Clone for WindowStatement
sourcefn clone(&self) -> WindowStatement
fn clone(&self) -> WindowStatement
Returns a copy of the value. Read more
1.0.0 · sourcefn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from source
. Read more
sourceimpl Debug for WindowStatement
impl Debug for WindowStatement
sourceimpl Default for WindowStatement
impl Default for WindowStatement
sourceimpl OrderedStatement for WindowStatement
impl OrderedStatement for WindowStatement
sourcefn order_by<T>(&mut self, col: T, order: Order) -> &mut Self where
T: IntoColumnRef,
fn order_by<T>(&mut self, col: T, order: Order) -> &mut Self where
T: IntoColumnRef,
Order by column. Read more
sourcefn order_by_tbl<T, C>(&mut self, table: T, col: C, order: Order) -> &mut Self where
T: IntoIden,
C: IntoIden,
fn order_by_tbl<T, C>(&mut self, table: T, col: C, order: Order) -> &mut Self where
T: IntoIden,
C: IntoIden,
Please use the [OrderedStatement::order_by
] with a tuple as [ColumnRef
]
sourcefn 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
.
sourcefn order_by_customs<T>(&mut self, cols: Vec<(T, Order)>) -> &mut Self where
T: ToString,
fn order_by_customs<T>(&mut self, cols: Vec<(T, Order)>) -> &mut Self where
T: ToString,
Order by custom string.
sourcefn order_by_columns<T>(&mut self, cols: Vec<(T, Order)>) -> &mut Self where
T: IntoColumnRef,
fn order_by_columns<T>(&mut self, cols: Vec<(T, Order)>) -> &mut Self where
T: IntoColumnRef,
Order by vector of columns.
sourcefn order_by_table_columns<T, C>(
&mut self,
cols: Vec<(T, C, Order)>
) -> &mut Self where
T: IntoIden,
C: IntoIden,
fn order_by_table_columns<T, C>(
&mut self,
cols: Vec<(T, C, Order)>
) -> &mut Self where
T: IntoIden,
C: IntoIden,
Please use the [OrderedStatement::order_by_columns
] with a tuple as [ColumnRef
]
sourcefn order_by_with_nulls<T>(
&mut self,
col: T,
order: Order,
nulls: NullOrdering
) -> &mut Self where
T: IntoColumnRef,
fn order_by_with_nulls<T>(
&mut self,
col: T,
order: Order,
nulls: NullOrdering
) -> &mut Self where
T: IntoColumnRef,
Order by column with nulls order option. Read more
sourcefn 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.
sourcefn order_by_customs_with_nulls<T>(
&mut self,
cols: Vec<(T, Order, NullOrdering)>
) -> &mut Self where
T: ToString,
fn order_by_customs_with_nulls<T>(
&mut self,
cols: Vec<(T, Order, NullOrdering)>
) -> &mut Self where
T: ToString,
Order by custom string with nulls order option.
sourcefn order_by_columns_with_nulls<T>(
&mut self,
cols: Vec<(T, Order, NullOrdering)>
) -> &mut Self where
T: IntoColumnRef,
fn order_by_columns_with_nulls<T>(
&mut self,
cols: Vec<(T, Order, NullOrdering)>
) -> &mut Self where
T: IntoColumnRef,
Order by vector of columns with nulls order option.
sourceimpl OverStatement for WindowStatement
impl OverStatement for WindowStatement
sourcefn partition_by<T>(&mut self, col: T) -> &mut Self where
T: IntoColumnRef,
fn partition_by<T>(&mut self, col: T) -> &mut Self where
T: IntoColumnRef,
Partition by column.
sourcefn partition_by_customs<T>(&mut self, cols: Vec<T>) -> &mut Self where
T: ToString,
fn partition_by_customs<T>(&mut self, cols: Vec<T>) -> &mut Self where
T: ToString,
Partition by custom string.
sourcefn partition_by_columns<T>(&mut self, cols: Vec<T>) -> &mut Self where
T: IntoColumnRef,
fn partition_by_columns<T>(&mut self, cols: Vec<T>) -> &mut Self where
T: IntoColumnRef,
Partition by vector of columns.
Auto Trait Implementations
impl !RefUnwindSafe for WindowStatement
impl Send for WindowStatement
impl Sync for WindowStatement
impl Unpin for WindowStatement
impl !UnwindSafe for WindowStatement
Blanket Implementations
sourceimpl<T> BorrowMut<T> for T where
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
const: unstable · sourcefn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
sourceimpl<T> Instrument for T
impl<T> Instrument for T
sourcefn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
sourcefn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
sourceimpl<T> ToOwned for T where
T: Clone,
impl<T> ToOwned for T where
T: Clone,
type Owned = T
type Owned = T
The resulting type after obtaining ownership.
sourcefn clone_into(&self, target: &mut T)
fn clone_into(&self, target: &mut T)
toowned_clone_into
)Uses borrowed data to replace owned data, usually by cloning. Read more
impl<V, T> VZip<V> for T where
V: MultiLane<T>,
impl<V, T> VZip<V> for T where
V: MultiLane<T>,
fn vzip(self) -> V
sourceimpl<T> WithSubscriber for T
impl<T> WithSubscriber for T
sourcefn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self> where
S: Into<Dispatch>,
fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self> where
S: Into<Dispatch>,
Attaches the provided Subscriber
to this type, returning a
WithDispatch
wrapper. Read more
sourcefn with_current_subscriber(self) -> WithDispatch<Self>
fn with_current_subscriber(self) -> WithDispatch<Self>
Attaches the current default Subscriber
to this type, returning a
WithDispatch
wrapper. Read more