rawsql-ts
Version:
High-performance SQL parser and AST analyzer written in TypeScript. Provides fast parsing and advanced transformation capabilities.
48 lines (47 loc) • 1.73 kB
TypeScript
import { CommonTable } from "../models/Clause";
import { SqlComponent } from "../models/SqlComponent";
import { ValueComponent } from "../models/ValueComponent";
import { TableColumnResolver } from "./TableColumnResolver";
export interface SelectOutputColumn {
name: string;
value: ValueComponent;
outputIndex: number;
sourceAlias: string | null;
sourceName: string | null;
sourceColumnName: string | null;
}
/**
* Collects SELECT output columns without collapsing duplicate output names.
*
* This collector is intended for callers that need stable SELECT-list positions.
* It keeps output order and assigns outputIndex after supported wildcard expansion.
*/
export declare class SelectOutputCollector {
private tableColumnResolver;
private commonTableCollector;
private commonTables;
constructor(tableColumnResolver?: TableColumnResolver | null, initialCommonTables?: CommonTable[] | null);
collect(arg: SqlComponent): SelectOutputColumn[];
private collectRaw;
private collectSimpleSelectQuery;
private collectSelectItem;
private expandWildcard;
private collectFromClause;
private collectJoinClause;
private getJoinSourceName;
private collectSourceExpression;
private findCommonTable;
private collectTableSource;
private collectNestedSelectQuery;
private collectCteQuery;
private collectReturningOutputs;
private extractReturningOutputs;
private extractSelectItemName;
private qualifyOutputs;
private createExplicitOutput;
private resolveColumnSourceMetadata;
private getSourceMatchNames;
private getColumnReferenceSourceAlias;
private getColumnReferenceSourceName;
private isSelectQuery;
}