Press n or j to go to the next uncovered block, b, p or k for the previous block.
| 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 | 154x 72x 72x 72x 72x 72x 71x 148x 95x 95x 95x 95x | import type { Fn } from './call-expressions.ts';
import { SqlExpression, type SqlExpressionVisitor } from './expression.ts';
import type { Literal } from './methods.ts';
/** Window function call `fn OVER (...)`. Created by {@link over}. */
export class Over extends SqlExpression {
/** @internal */
static override readonly kind = 'Over';
/** Window function, e.g. `fn('row_number')`. */
readonly fn: Fn | Literal;
/** `PARTITION BY` attributes or expressions. */
readonly partitionBy: readonly unknown[];
/** `ORDER BY` items: attribute, `[attribute, direction]` or expression. */
readonly orderBy: readonly unknown[];
/**
* @param fn - Window function.
* @param partitionBy - `PARTITION BY` items.
* @param orderBy - `ORDER BY` items.
*/
constructor(fn: Fn | Literal, partitionBy: readonly unknown[], orderBy: readonly unknown[]) {
super();
this.fn = fn;
this.partitionBy = partitionBy;
this.orderBy = orderBy;
Object.freeze(this);
}
/** @internal */
accept<R>(visitor: SqlExpressionVisitor<R>): R {
return visitor.visitOver(this);
}
}
/** Row constructor `(a, b, ...)` for row comparisons. Created by {@link tuple}. */
export class Tuple extends SqlExpression {
/** @internal */
static override readonly kind = 'Tuple';
/** Row items. */
readonly items: readonly unknown[];
/**
* @param items - Row items.
*/
constructor(items: readonly unknown[]) {
super();
this.items = items;
Object.freeze(this);
}
/** @internal */
accept<R>(visitor: SqlExpressionVisitor<R>): R {
return visitor.visitTuple(this);
}
}
|