@sequeljs/ast
Version:
A SQL AST manager for JavaScript
230 lines • 14.5 kB
TypeScript
import Attribute from '../attributes/Attribute';
import Binary from '../nodes/Binary';
import BindParam from '../nodes/BindParam';
import DeleteStatement from '../nodes/DeleteStatement';
import Grouping from '../nodes/Grouping';
import In from '../nodes/In';
import JoinSource from '../nodes/JoinSource';
import SQLLiteral from '../nodes/SQLLiteral';
import SelectStatement from '../nodes/SelectStatement';
import TableAlias from '../nodes/TableAlias';
import UpdateStatement from '../nodes/UpdateStatement';
import Visitor from './Visitor';
import type Collector from '../collectors/Collector';
import type Addition from '../nodes/Addition';
import type And from '../nodes/And';
import type As from '../nodes/As';
import type Ascending from '../nodes/Ascending';
import type Assignment from '../nodes/Assignment';
import type Avg from '../nodes/Avg';
import type Between from '../nodes/Between';
import type Bin from '../nodes/Bin';
import type Case from '../nodes/Case';
import type Casted from '../nodes/Casted';
import type Comment from '../nodes/Comment';
import type Count from '../nodes/Count';
import type CurrentRow from '../nodes/CurrentRow';
import type Descending from '../nodes/Descending';
import type Distinct from '../nodes/Distinct';
import type DistinctOn from '../nodes/DistinctOn';
import type Division from '../nodes/Division';
import type DoesNotMatch from '../nodes/DoesNotMatch';
import type Else from '../nodes/Else';
import type Equality from '../nodes/Equality';
import type Except from '../nodes/Except';
import type Exists from '../nodes/Exists';
import type Extract from '../nodes/Extract';
import type False from '../nodes/False';
import type Following from '../nodes/Following';
import type FullOuterJoin from '../nodes/FullOuterJoin';
import type GreaterThan from '../nodes/GreaterThan';
import type GreaterThanOrEqual from '../nodes/GreaterThanOrEqual';
import type Group from '../nodes/Group';
import type InfixOperation from '../nodes/InfixOperation';
import type InnerJoin from '../nodes/InnerJoin';
import type InsertStatement from '../nodes/InsertStatement';
import type Intersect from '../nodes/Intersect';
import type IsDistinctFrom from '../nodes/IsDistinctFrom';
import type IsNotDistinctFrom from '../nodes/IsNotDistinctFrom';
import type LessThan from '../nodes/LessThan';
import type LessThanOrEqual from '../nodes/LessThanOrEqual';
import type Limit from '../nodes/Limit';
import type Lock from '../nodes/Lock';
import type Matches from '../nodes/Matches';
import type Max from '../nodes/Max';
import type Min from '../nodes/Min';
import type Multiplication from '../nodes/Multiplication';
import type NamedSQLFunction from '../nodes/NamedSQLFunction';
import type NamedWindow from '../nodes/NamedWindow';
import type Not from '../nodes/Not';
import type NotEqual from '../nodes/NotEqual';
import type NotIn from '../nodes/NotIn';
import type NotRegexp from '../nodes/NotRegexp';
import type Offset from '../nodes/Offset';
import type On from '../nodes/On';
import type OptimizerHints from '../nodes/OptimizerHints';
import type Or from '../nodes/Or';
import type OuterJoin from '../nodes/OuterJoin';
import type Over from '../nodes/Over';
import type Preceding from '../nodes/Preceding';
import type Quoted from '../nodes/Quoted';
import type Range from '../nodes/Range';
import type Regexp from '../nodes/Regexp';
import type RightOuterJoin from '../nodes/RightOuterJoin';
import type Rows from '../nodes/Rows';
import type SQLFunction from '../nodes/SQLFunction';
import type SelectCore from '../nodes/SelectCore';
import type StringJoin from '../nodes/StringJoin';
import type Subtraction from '../nodes/Subtraction';
import type Sum from '../nodes/Sum';
import type True from '../nodes/True';
import type UnaryOperation from '../nodes/UnaryOperation';
import type Union from '../nodes/Union';
import type UnionAll from '../nodes/UnionAll';
import type UnqualifiedColumn from '../nodes/UnqualifiedColumn';
import type ValuesList from '../nodes/ValuesList';
import type When from '../nodes/When';
import type Window from '../nodes/Window';
import type With from '../nodes/With';
import type WithRecursive from '../nodes/WithRecursive';
import type AttributeBoolean from '../attributes/Boolean';
import type AttributeDecimal from '../attributes/Decimal';
import type AttributeFloat from '../attributes/Float';
import type AttributeInteger from '../attributes/Integer';
import type AttributeString from '../attributes/String';
import type AttributeTime from '../attributes/Time';
import type Connection from '../interfaces/Connection';
import type SelectManager from '../managers/SelectManager';
import type Table from '../Table';
import type Visitable from './Visitable';
export default class ToSQL extends Visitor {
connection: Connection;
constructor(connection: Connection);
compile(node: Visitable, collector?: Collector<string | string[]>): string | string[];
protected aggregate(name: string, thing: SQLFunction, col: Collector): Collector;
protected collectInClause(left: Visitable, right: Visitable | Visitable[], col: Collector): Collector;
protected collectNodesFor(nodes: Visitable[], col: Collector, spacer: string, connector?: string): Collector;
protected collectNotInClause(left: Visitable, right: Visitable | Visitable[], col: Collector): Collector;
protected collectOptimizerHints(thing: SelectCore, col: Collector): Collector;
protected hasJoinSources(thing: any): boolean;
protected hasLimitOrOffsetOrOrders(thing: DeleteStatement | UpdateStatement): boolean;
protected infixValue(thing: Binary, col: Collector, value: string): Collector;
protected infixValueWithParen(thing: Binary, col: Collector, value: string, suppressParens?: boolean): Collector;
protected injectJoin(things: Visitable[], col: Collector, joinStr: string): Collector;
protected isDistinctFrom(thing: IsDistinctFrom | IsNotDistinctFrom, col: Collector): Collector;
protected isUnboundable(value: any): boolean;
protected literal(thing: bigint | number | SQLLiteral, col: Collector): Collector;
protected maybeVisit(thing: Visitable, col: Collector): Collector;
protected prepareDeleteUpdateStatement(thing: DeleteStatement): DeleteStatement;
protected prepareDeleteUpdateStatement(thing: UpdateStatement): UpdateStatement;
protected prepareDeleteStatement(thing: DeleteStatement): DeleteStatement;
protected prepareUpdateStatement(thing: UpdateStatement): UpdateStatement;
protected quote(value: Visitable): number | string;
protected quoteColumnName(name: number | string | SQLLiteral): string;
protected quoteTableName(name: number | string | SQLLiteral): string;
protected quoted(val: Visitable, attribute: Attribute | string | null): number | string;
protected sanitizeAsSQLComment(value: any): string | SQLLiteral;
protected unsupported(thing: unknown, _: Collector): Collector;
protected visitAddition(thing: Addition, col: Collector): Collector;
protected visitAnd(thing: And, col: Collector): Collector;
protected visitArray(things: Array<Visitable>, col: Collector): Collector;
protected visitAs(thing: As, col: Collector): Collector;
protected visitAscending(thing: Ascending, col: Collector): Collector;
protected visitAssignment(thing: Assignment, col: Collector): Collector;
protected visitAttributesAttribute(thing: Attribute, col: Collector): Collector;
protected visitAttributesBoolean(thing: AttributeBoolean, col: Collector): Collector;
protected visitAttributesDecimal(thing: AttributeDecimal, col: Collector): Collector;
protected visitAttributesFloat(thing: AttributeFloat, col: Collector): Collector;
protected visitAttributesInteger(thing: AttributeInteger, col: Collector): Collector;
protected visitAttributesString(thing: AttributeString, col: Collector): Collector;
protected visitAttributesTime(thing: AttributeTime, col: Collector): Collector;
protected visitAvg(thing: Avg, col: Collector): Collector;
protected visitBetween(thing: Between, col: Collector): Collector;
protected visitBigInt(thing: bigint, col: Collector): Collector;
protected visitBin(thing: Bin, col: Collector): Collector;
protected visitBindParam(thing: BindParam, col: Collector): Collector;
protected visitBoolean(thing: boolean, col: Collector): Collector;
protected visitCase(thing: Case, col: Collector): Collector;
protected visitCasted(thing: Casted, col: Collector): Collector;
protected visitComment(thing: Comment, col: Collector): Collector;
protected visitCount(thing: Count, col: Collector): Collector;
protected visitCurrentRow(_: CurrentRow, col: Collector): Collector;
protected visitDate(thing: Date, col: Collector): Collector;
protected visitDeleteStatement(thing: DeleteStatement, col: Collector): Collector;
protected visitDescending(thing: Descending, col: Collector): Collector;
protected visitDistinct(thing: Distinct, col: Collector): Collector;
protected visitDistinctOn(_1: DistinctOn, _2: Collector): Collector;
protected visitDivision(thing: Division, col: Collector): Collector;
protected visitDoesNotMatch(thing: DoesNotMatch, col: Collector): Collector;
protected visitElse(thing: Else, col: Collector): Collector;
protected visitEquality(thing: Equality, col: Collector): Collector;
protected visitExcept(thing: Except, col: Collector): Collector;
protected visitExists(thing: Exists, col: Collector): Collector;
protected visitExtract(thing: Extract, col: Collector): Collector;
protected visitFalse(_: False, col: Collector): Collector;
protected visitFollowing(thing: Following, col: Collector): Collector;
protected visitFullOuterJoin(thing: FullOuterJoin, col: Collector): Collector;
protected visitGreaterThan(thing: GreaterThan, col: Collector): Collector;
protected visitGreaterThanOrEqual(thing: GreaterThanOrEqual, col: Collector): Collector;
protected visitGroup(thing: Group, col: Collector): Collector;
protected visitGrouping(thing: Grouping, col: Collector): Collector;
protected visitIn(thing: In, col: Collector): Collector;
protected visitInfixOperation(thing: InfixOperation, col: Collector): Collector;
protected visitInnerJoin(thing: InnerJoin, col: Collector): Collector;
protected visitInsertStatement(thing: InsertStatement, col: Collector): Collector;
protected visitIntersect(thing: Intersect, col: Collector): Collector;
protected visitIsDistinctFrom(thing: IsDistinctFrom, col: Collector): Collector;
protected visitIsNotDistinctFrom(thing: IsNotDistinctFrom, col: Collector): Collector;
protected visitJoinSource(thing: JoinSource, col: Collector): Collector;
protected visitLessThan(thing: LessThan, col: Collector): Collector;
protected visitLessThanOrEqual(thing: LessThanOrEqual, col: Collector): Collector;
protected visitLimit(thing: Limit, col: Collector): Collector;
protected visitLock(thing: Lock, col: Collector): Collector;
protected visitMatches(thing: Matches, col: Collector): Collector;
protected visitMax(thing: Max, col: Collector): Collector;
protected visitMin(thing: Min, col: Collector): Collector;
protected visitMultiplication(thing: Multiplication, col: Collector): Collector;
protected visitNamedSQLFunction(thing: NamedSQLFunction, col: Collector): Collector;
protected visitNamedWindow(thing: NamedWindow, col: Collector): Collector;
protected visitNot(thing: Not, col: Collector): Collector;
protected visitNotEqual(thing: NotEqual, col: Collector): Collector;
protected visitNotIn(thing: NotIn, col: Collector): Collector;
protected visitNotRegexp(_1: NotRegexp, _2: Collector): Collector;
protected visitNumber(thing: number, col: Collector): Collector;
protected visitNull(thing: null, col: Collector): Collector;
protected visitOffset(thing: Offset, col: Collector): Collector;
protected visitOn(thing: On, col: Collector): Collector;
protected visitOptimizerHints(thing: OptimizerHints, col: Collector): Collector;
protected visitOr(thing: Or, col: Collector): Collector;
protected visitOuterJoin(thing: OuterJoin, col: Collector): Collector;
protected visitOver(thing: Over, col: Collector): Collector;
protected visitPreceding(thing: Preceding, col: Collector): Collector;
protected visitQuoted(thing: Quoted, col: Collector): Collector;
protected visitRange(thing: Range, col: Collector): Collector;
protected visitRegexp(_1: Regexp, _2: Collector): Collector;
protected visitRightOuterJoin(thing: RightOuterJoin, col: Collector): Collector;
protected visitRows(thing: Rows, col: Collector): Collector;
protected visitSelectCore(thing: SelectCore, col: Collector): Collector;
protected visitSelectManager(thing: SelectManager, col: Collector): Collector;
protected visitSelectStatement(thing: SelectStatement, col: Collector): Collector;
protected visitSQLLiteral(thing: SQLLiteral, col: Collector): Collector;
protected visitString(thing: string, col: Collector): Collector;
protected visitStringJoin(thing: StringJoin, col: Collector): Collector;
protected visitSubtraction(thing: Subtraction, col: Collector): Collector;
protected visitSum(thing: Sum, col: Collector): Collector;
protected visitSymbol(thing: symbol, col: Collector): Collector;
protected visitTable(thing: Table, col: Collector): Collector;
protected visitTableAlias(thing: TableAlias, col: Collector): Collector;
protected visitTrue(_: True, col: Collector): Collector;
protected visitUnaryOperation(thing: UnaryOperation, col: Collector): Collector;
protected visitUnion(thing: Union, col: Collector): Collector;
protected visitUnionAll(thing: UnionAll, col: Collector): Collector;
protected visitUnqualifiedColumn(thing: UnqualifiedColumn, col: Collector): Collector;
protected visitUpdateStatement(thing: UpdateStatement, col: Collector): Collector;
protected visitValuesList(thing: ValuesList, col: Collector): Collector;
protected visitWhen(thing: When, col: Collector): Collector;
protected visitWindow(thing: Window, col: Collector): Collector;
protected visitWith(thing: With, col: Collector): Collector;
protected visitWithRecursive(thing: WithRecursive, col: Collector): Collector;
}
//# sourceMappingURL=ToSQL.d.ts.map