pub struct WindowSpec {
pub window_name: Option<String>,
pub partition_by: Vec<String>,
pub order_by: Vec<OrderSpec>,
pub frame: Option<FrameClause>,
}Expand description
Window specification (OVER clause).
Fields§
§window_name: Option<String>Reference to a named window.
partition_by: Vec<String>PARTITION BY columns.
order_by: Vec<OrderSpec>ORDER BY specifications.
frame: Option<FrameClause>Frame clause.
Implementations§
Source§impl WindowSpec
impl WindowSpec
Sourcepub fn partition_by<I, S>(self, columns: I) -> Self
pub fn partition_by<I, S>(self, columns: I) -> Self
Add PARTITION BY columns.
Sourcepub fn order_by(self, column: impl Into<String>, direction: SortOrder) -> Self
pub fn order_by(self, column: impl Into<String>, direction: SortOrder) -> Self
Add an ORDER BY column (ascending).
Sourcepub fn order_by_nulls(
self,
column: impl Into<String>,
direction: SortOrder,
nulls: NullsPosition,
) -> Self
pub fn order_by_nulls( self, column: impl Into<String>, direction: SortOrder, nulls: NullsPosition, ) -> Self
Add an ORDER BY column with NULLS position.
Sourcepub fn rows(self, start: FrameBound, end: Option<FrameBound>) -> Self
pub fn rows(self, start: FrameBound, end: Option<FrameBound>) -> Self
Set ROWS frame.
Sourcepub fn range(self, start: FrameBound, end: Option<FrameBound>) -> Self
pub fn range(self, start: FrameBound, end: Option<FrameBound>) -> Self
Set RANGE frame.
Sourcepub fn groups(self, start: FrameBound, end: Option<FrameBound>) -> Self
pub fn groups(self, start: FrameBound, end: Option<FrameBound>) -> Self
Set GROUPS frame (PostgreSQL).
Sourcepub fn rows_unbounded_preceding(self) -> Self
pub fn rows_unbounded_preceding(self) -> Self
Common frame: ROWS BETWEEN UNBOUNDED PRECEDING AND CURRENT ROW.
Sourcepub fn rows_unbounded_following(self) -> Self
pub fn rows_unbounded_following(self) -> Self
Common frame: ROWS BETWEEN CURRENT ROW AND UNBOUNDED FOLLOWING.
Sourcepub fn rows_around(self, n: u32) -> Self
pub fn rows_around(self, n: u32) -> Self
Common frame: ROWS BETWEEN n PRECEDING AND n FOLLOWING.
Sourcepub fn range_unbounded_preceding(self) -> Self
pub fn range_unbounded_preceding(self) -> Self
Common frame: RANGE BETWEEN UNBOUNDED PRECEDING AND CURRENT ROW.
Sourcepub fn to_sql(&self, db_type: DatabaseType) -> String
pub fn to_sql(&self, db_type: DatabaseType) -> String
Generate the OVER clause SQL.
Trait Implementations§
Source§impl Clone for WindowSpec
impl Clone for WindowSpec
Source§fn clone(&self) -> WindowSpec
fn clone(&self) -> WindowSpec
Returns a duplicate 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 WindowSpec
impl Debug for WindowSpec
Source§impl Default for WindowSpec
impl Default for WindowSpec
Source§fn default() -> WindowSpec
fn default() -> WindowSpec
Returns the “default value” for a type. Read more
Source§impl<'de> Deserialize<'de> for WindowSpec
impl<'de> Deserialize<'de> for WindowSpec
Source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
Deserialize this value from the given Serde deserializer. Read more
Source§impl PartialEq for WindowSpec
impl PartialEq for WindowSpec
Source§impl Serialize for WindowSpec
impl Serialize for WindowSpec
impl Eq for WindowSpec
impl StructuralPartialEq for WindowSpec
Auto Trait Implementations§
impl Freeze for WindowSpec
impl RefUnwindSafe for WindowSpec
impl Send for WindowSpec
impl Sync for WindowSpec
impl Unpin for WindowSpec
impl UnwindSafe for WindowSpec
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more