Set (or narrow) the target dialect. Only matters for the rare cases where OVER-clause syntax genuinely diverges (all listed dialects use the same ANSI-standard OVER syntax today, so this is mostly a documented escape hatch for future dialect-specific tweaks).
Add one or more PARTITION BY columns/expressions. Repeatable/additive.
Add an ORDER BY entry to the window definition. Call multiple times to order by multiple columns; each call appends one entry.
Optionaldirection: WindowOrderDirectionOptionalnulls: WindowNullsSet a ROWS frame clause, e.g. ROWS BETWEEN UNBOUNDED PRECEDING AND CURRENT ROW.
Set a RANGE frame clause, e.g. RANGE BETWEEN UNBOUNDED PRECEDING AND CURRENT ROW.
Render the FN(args) OVER (...) SQL fragment (no alias).
Terminal call: returns an [expr, alias] tuple compatible with the
existing attributes: [...] pattern (see attributeToSql() /
attributeToSqlWithAlias() in sql-compiler.ts, both of which already
know how to render [LiteralExpression, alias] tuples without any core
changes).
Allow the builder to be used directly wherever a raw SQL literal is
expected (e.g. passed straight into literal()-consuming positions)
without requiring .as(...).
A chainable builder that accumulates PARTITION BY / ORDER BY / frame clauses for a single window function call and renders the final
FN(args) OVER (...)SQL fragment.