@uwdata/mosaic-sql
Version:
SQL query construction and analysis.
128 lines • 4.63 kB
TypeScript
import type { ExprVarArgs, OrderByExpr, WindowFunctionName } from '../types.js';
import type { AggregateNode } from './aggregate.js';
import type { WindowFrameNode } from './window-frame.js';
import { ExprNode, SQLNode } from './node.js';
export declare class WindowClauseNode extends SQLNode {
/** The window name. */
readonly name: string;
/** The window definition. */
readonly def: WindowDefNode;
/**
* Instantiate a window clause node.
* @param name The window name.
* @param def The window definition.
*/
constructor(name: string, def: WindowDefNode);
/**
* Generate a SQL query string for this node.
*/
toString(): string;
}
export declare class WindowNode extends ExprNode {
readonly func: WindowFunctionNode | AggregateNode;
readonly def: WindowDefNode;
/**
* Instantiate a window node.
* @param func The window function call.
* @param over The window definition or name.
*/
constructor(func: WindowFunctionNode | AggregateNode, over?: WindowDefNode);
/**
* Return an updated window over a named window definition.
* @param name The window definition name.
* @returns A new window node.
*/
over(name: string): WindowNode;
/**
* Return an updated window with the given partitions.
* @param expr The partition by criteria.
* @returns A new window node.
*/
partitionby(...expr: ExprVarArgs[]): WindowNode;
/**
* Return an updated window with the given ordering.
* @param expr The order by criteria.
* @returns A new window node.
*/
orderby(...expr: ExprVarArgs[]): WindowNode;
/**
* Return an updated window with the given frame definition.
* @param framedef The frame definition.
* @returns A new window node.
*/
frame(framedef: WindowFrameNode): WindowNode;
/**
* Generate a SQL query string for this node.
*/
toString(): string;
}
export declare class WindowFunctionNode extends ExprNode {
/** The window function name. */
readonly name: string;
/** The window function arguments. */
readonly args: ExprNode[];
/** Flag to ignore null values. */
readonly ignoreNulls: boolean;
/** Order by expression for window arguments. */
readonly order: ExprNode[];
/**
* Instantiate a window function call node.
* @param name The window function name.
* @param args The window function arguments.
* @param ignoreNulls Flag to ignore null values.
* @param argOrder Order expressions for window arguments.
* Note that this argument ordering is distinct from the window ordering.
*/
constructor(name: WindowFunctionName, args?: ExprNode[], ignoreNulls?: boolean, argOrder?: OrderByExpr);
/**
* Generate a SQL query string for this node.
*/
toString(): string;
}
export declare class WindowDefNode extends SQLNode {
/** The base window definition name. */
readonly name?: string;
/** The partition by criteria. */
readonly partition?: ExprNode[];
/** The order by criteria. */
readonly order?: ExprNode[];
/** The window frame definition. */
readonly framedef?: WindowFrameNode;
/**
* Instantiate a window definition node.
* @param name The base window definition name.
* @param partition The partition by criteria.
* @param order The order by criteria.
* @param framedef The window frame definition.
*/
constructor(name?: string, partition?: ExprNode[], order?: ExprNode[], framedef?: WindowFrameNode);
/**
* Return an updated window definition with the given base name.
* @param name The base window definition name.
* @returns A new window definition node.
*/
over(name: string): WindowDefNode;
/**
* Return an updated window definition with the given partitions.
* @param expr The partition by criteria.
* @returns A new window definition node.
*/
partitionby(...expr: ExprVarArgs[]): WindowDefNode;
/**
* Return an updated window definition with the given ordering.
* @param expr The order by criteria.
* @returns A new window definition node.
*/
orderby(...expr: ExprVarArgs[]): WindowDefNode;
/**
* Return an updated window definition with the given frame definition.
* @param framedef The frame definition.
* @return A new window definition node.
*/
frame(framedef: WindowFrameNode): WindowDefNode;
/**
* Generate a SQL query string for this node.
*/
toString(): string;
}
//# sourceMappingURL=window.d.ts.map