pub struct Frame {
pub mode: Option<FrameMode>,
pub start: Option<Expr>,
pub end: Option<Expr>,
pub exclusion: Option<FrameExclusion>,
}Expand description
A window frame: which rows around the current one the window function sees.
From PostgreSQL 17, https://www.postgresql.org/docs/17/sql-expressions.html#SYNTAX-WINDOW-FUNCTIONS:
{ RANGE | ROWS | GROUPS } frame_start [ frame_exclusion ]
{ RANGE | ROWS | GROUPS } BETWEEN frame_start AND frame_end [ frame_exclusion ]
frame_start, frame_end:
UNBOUNDED PRECEDING | offset PRECEDING | CURRENT ROW
| offset FOLLOWING | UNBOUNDED FOLLOWING
frame_exclusion:
EXCLUDE CURRENT ROW | EXCLUDE GROUP | EXCLUDE TIES | EXCLUDE NO OTHERSTwo defaults from that grammar are baked in, because they are what the keywords mean rather than what this library prefers:
- the mode defaults to
RANGE, and frame_startdefaults toUNBOUNDED PRECEDING.
So setting only exclusion still renders a complete frame,
RANGE UNBOUNDED PRECEDING EXCLUDE TIES. BETWEEN appears exactly when
there is an end bound — that is the whole difference between the two
productions, and writing it without one is a syntax error.
bob carries a separate Defined bool that its setters flip, which can disagree
with the fields. Here “defined” is derived: a frame is absent when all four
parts are, which is also what makes Frame::default() render
nothing.
Fields§
§mode: Option<FrameMode>What the offsets count in. None renders as RANGE.
start: Option<Expr>The start bound. None renders as UNBOUNDED PRECEDING.
end: Option<Expr>The end bound. Its presence is what turns the frame into a BETWEEN.
exclusion: Option<FrameExclusion>Rows to leave out of the frame even though they are inside it.
Implementations§
Source§impl Frame
impl Frame
Sourcepub fn set_exclusion(&mut self, exclusion: FrameExclusion)
pub fn set_exclusion(&mut self, exclusion: FrameExclusion)
Set the exclusion.