logo
pub struct WindowStatement { /* private fields */ }
Expand description

Implementations

Construct a new WindowStatement

Construct a new WindowStatement with PARTITION BY column

Construct a new WindowStatement with PARTITION BY custom

Construct a new WindowStatement with ORDER BY column

Construct a new WindowStatement with ORDER BY custom

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""#
);

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""#
);

frame clause

Trait Implementations

Returns a copy of the value. Read more
Performs copy-assignment from source. Read more
Formats the value using the given formatter. Read more
Returns the “default value” for a type. Read more
Clear order expressions
Order by column. Read more
👎Deprecated since 0.9.0: Please use the [OrderedStatement::order_by] with a tuple as [ColumnRef]
Order by SimpleExpr.
Order by custom string.
Order by vector of columns.
👎Deprecated since 0.9.0: Please use the [OrderedStatement::order_by_columns] with a tuple as [ColumnRef]
Order by column with nulls order option. Read more
Order by SimpleExpr with nulls order option.
Order by custom string with nulls order option.
Order by vector of columns with nulls order option.
Partition by column.
Partition by custom string.
Partition by vector of columns.

Auto Trait Implementations

Blanket Implementations

Gets the TypeId of self. Read more
Immutably borrows from an owned value. Read more
Mutably borrows from an owned value. Read more

Returns the argument unchanged.

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more
Instruments this type with the current Span, returning an Instrumented wrapper. Read more

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Should always be Self
The resulting type after obtaining ownership.
Creates owned data from borrowed data, usually by cloning. Read more
Uses borrowed data to replace owned data, usually by cloning. Read more
The type returned in the event of a conversion error.
Performs the conversion.
The type returned in the event of a conversion error.
Performs the conversion.
Attaches the provided Subscriber to this type, returning a WithDispatch wrapper. Read more
Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more