final class WindowFrame
    implements Clause
    uses Snapshot
Public API: explicitly declared with @visibility public.

The frame of a window: its mode, its start, an optional end, and an optional exclusion.

A frame written with a start only ends at the current row. The combinations the grammar rejects cannot be constructed: a frame does not start at UNBOUNDED FOLLOWING or end at UNBOUNDED PRECEDING, a frame that starts at the current row does not end before it, and a frame that starts after the current row does not end at or before it. Source: https://www.postgresql.org/docs/17/sql-expressions.html#SYNTAX-WINDOW-FUNCTIONS.

Reading a frame with a start onlydoctest
$frame = new \SqlSemantics\Platform\PostgreSql\Statement\Invocation\WindowFrame(
        \SqlSemantics\Platform\PostgreSql\Statement\Invocation\FrameMode::Rows,
        new \SqlSemantics\Platform\PostgreSql\Statement\Invocation\FrameBound(\SqlSemantics\Platform\PostgreSql\Statement\Invocation\FrameBoundKind::UnboundedPreceding),
    );
    [$frame->mode->value, $frame->end] // => ['ROWS', null]
Rejecting a frame that starts at UNBOUNDED FOLLOWINGdoctest
new \SqlSemantics\Platform\PostgreSql\Statement\Invocation\WindowFrame(
        \SqlSemantics\Platform\PostgreSql\Statement\Invocation\FrameMode::Rows,
        new \SqlSemantics\Platform\PostgreSql\Statement\Invocation\FrameBound(\SqlSemantics\Platform\PostgreSql\Statement\Invocation\FrameBoundKind::UnboundedFollowing),
    ) // throws \SqlSemantics\Platform\PostgreSql\Model\Diagnostic\InvalidConstruction

Properties§

public FrameMode $mode
public FrameBound $start
public FrameBound|null $end = null
public FrameExclusion|null $exclusion = null

Methods§

public function __construct(
    public FrameMode $mode,
    public FrameBound $start,
    public FrameBound|null $end = null,
    public FrameExclusion|null $exclusion = null,
)

Parameters

$modeFrameModeHow the bounds are measured
$startFrameBoundWhere the frame starts
$endFrameBound|nullWhere the frame ends; null when only a start is written
$exclusionFrameExclusion|nullThe rows left out around the current row
Calls 6
public function deriveClause(Derivation $derivation, Environment $environment): void

Derives the offset expressions of the bounds.

Parameters

$derivationDerivation
$environmentEnvironment
Test cases 1
Calls 1
public function render(Output $out): void

Writes the mode, the bounds and the exclusion.

Parameters

$outOutput
Test cases 2
Calls 3

Test cases 11§

Test cases that cover or call this symbol, from the coverage report and from the analyzed test sources.

Dedicated tests 5
Other tests reaching this symbol 6

Relations§

Instantiated in 1
Type declarations 2