Comparing version 5.3.0 to 5.4.0
@@ -66,2 +66,3 @@ 'use strict'; | ||
this.visitingFunctionCall = false; | ||
this.visitingDistinctOn = false; | ||
this.output = []; | ||
@@ -419,3 +420,6 @@ this.params = []; | ||
visitDistinctOn(distinctOnNode) { | ||
return [`DISTINCT ON(${distinctOnNode.nodes.map((n) => this.visit(n).join()).join(', ')})`]; | ||
this.visitingDistinctOn = true; | ||
const result = [`DISTINCT ON(${distinctOnNode.nodes.map((n) => this.visit(n).join()).join(', ')})`]; | ||
this.visitingDistinctOn = false; | ||
return result; | ||
} | ||
@@ -732,2 +736,3 @@ visitAlias(aliasNode) { | ||
const inCast = this.visitingCast; | ||
const inDistinctOn = this.visitingDistinctOn; | ||
const txt = []; | ||
@@ -806,3 +811,3 @@ let closeParen = 0; | ||
} | ||
if (inSelectClause && !inFunctionCall && !inCast && (columnNode.alias || columnNode.property !== columnNode.name)) { | ||
if (inSelectClause && !inFunctionCall && !inCast && !inDistinctOn && (columnNode.alias || columnNode.property !== columnNode.name)) { | ||
txt.push(this.aliasText + this.quote(columnNode.alias || columnNode.property)); | ||
@@ -809,0 +814,0 @@ } |
@@ -36,2 +36,3 @@ /// <reference types="node" /> | ||
protected visitingFunctionCall: boolean; | ||
protected visitingDistinctOn: boolean; | ||
constructor(config: any); | ||
@@ -38,0 +39,0 @@ _getParameterText(index: number, value: any): string; |
@@ -63,2 +63,3 @@ 'use strict'; | ||
this.visitingFunctionCall = false; | ||
this.visitingDistinctOn = false; | ||
this.output = []; | ||
@@ -416,3 +417,6 @@ this.params = []; | ||
visitDistinctOn(distinctOnNode) { | ||
return [`DISTINCT ON(${distinctOnNode.nodes.map((n) => this.visit(n).join()).join(', ')})`]; | ||
this.visitingDistinctOn = true; | ||
const result = [`DISTINCT ON(${distinctOnNode.nodes.map((n) => this.visit(n).join()).join(', ')})`]; | ||
this.visitingDistinctOn = false; | ||
return result; | ||
} | ||
@@ -729,2 +733,3 @@ visitAlias(aliasNode) { | ||
const inCast = this.visitingCast; | ||
const inDistinctOn = this.visitingDistinctOn; | ||
const txt = []; | ||
@@ -803,3 +808,3 @@ let closeParen = 0; | ||
} | ||
if (inSelectClause && !inFunctionCall && !inCast && (columnNode.alias || columnNode.property !== columnNode.name)) { | ||
if (inSelectClause && !inFunctionCall && !inCast && !inDistinctOn && (columnNode.alias || columnNode.property !== columnNode.name)) { | ||
txt.push(this.aliasText + this.quote(columnNode.alias || columnNode.property)); | ||
@@ -806,0 +811,0 @@ } |
@@ -25,2 +25,6 @@ /// <reference types="node" /> | ||
case(whenList: any[], thenList: any[], elseBranch?: any): CaseNode; | ||
prefixUnaryOperator(operator: string): PrefixUnaryNode; | ||
postfixUnaryOperator(operator: string): PostfixUnaryNode; | ||
binaryOperator(operator: string, right: any): BinaryNode; | ||
ternaryOperator(operator: string, middle: any, separator: string, right: any): TernaryNode; | ||
isNull: (this: INodeable) => PostfixUnaryNode; | ||
@@ -79,2 +83,6 @@ isNotNull: (this: INodeable) => PostfixUnaryNode; | ||
case(whenList: any[], thenList: any[], elseBranch?: any): CaseNode; | ||
prefixUnaryOperator(operator: string): PrefixUnaryNode; | ||
postfixUnaryOperator(operator: string): PostfixUnaryNode; | ||
binaryOperator(operator: string, right: any): BinaryNode; | ||
ternaryOperator(operator: string, middle: any, separator: string, right: any): TernaryNode; | ||
isNull: (this: INodeable) => PostfixUnaryNode; | ||
@@ -207,2 +215,12 @@ isNotNull: (this: INodeable) => PostfixUnaryNode; | ||
declare class PrefixUnaryNode extends ValueExpressionNode { | ||
left: Node; | ||
operator: string; | ||
constructor(config: { | ||
left: Node; | ||
operator: string; | ||
}); | ||
as: (this: Node, alias: string) => AliasNode; | ||
} | ||
declare class SliceNode extends ValueExpressionNode { | ||
@@ -340,12 +358,2 @@ value: Node; | ||
declare class PrefixUnaryNode extends ValueExpressionNode { | ||
left: Node; | ||
operator: string; | ||
constructor(config: { | ||
left: Node; | ||
operator: string; | ||
}); | ||
as: (this: Node, alias: string) => AliasNode; | ||
} | ||
declare class Query<T> extends ValueExpressionBaseNode { | ||
@@ -590,2 +598,6 @@ table: Table<T>; | ||
case(whenList: any[], thenList: any[], elseBranch?: any): CaseNode; | ||
prefixUnaryOperator(operator: string): PrefixUnaryNode; | ||
postfixUnaryOperator(operator: string): PostfixUnaryNode; | ||
binaryOperator(operator: string, right: any): BinaryNode; | ||
ternaryOperator(operator: string, middle: any, separator: string, right: any): TernaryNode; | ||
isNull: (this: INodeable) => PostfixUnaryNode; | ||
@@ -750,2 +762,6 @@ isNotNull: (this: INodeable) => PostfixUnaryNode; | ||
function(functionName: string): (...args: any[]) => FunctionCallNode; | ||
prefixUnaryOperator: (operator: string) => (left: any) => PrefixUnaryNode; | ||
postfixUnaryOperator: (operator: string) => (left: any) => PostfixUnaryNode; | ||
binaryOperator: (operator: string) => (left: any, val: any) => BinaryNode; | ||
ternaryOperator: (operator: string, separator: string) => (left: any, middle: any, right: any) => TernaryNode; | ||
define<T>(def: TableDefinition): TableWithColumns<T>; | ||
@@ -752,0 +768,0 @@ defineColumn<T>(def: ColumnDefinition): Column<T>; |
@@ -8,3 +8,3 @@ { | ||
"description": "SQL Builder", | ||
"version": "5.3.0", | ||
"version": "5.4.0", | ||
"homepage": "https://github.com/charsleysa/node-sql-ts", | ||
@@ -11,0 +11,0 @@ "license": "MIT", |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
1048400
16488