sql-select-ts
Advanced tools
Comparing version 2.0.3 to 2.0.4
@@ -25,2 +25,3 @@ import { SafeString } from "../safe-string"; | ||
private setPrewhere; | ||
private setExcept; | ||
private setHaving; | ||
@@ -45,2 +46,6 @@ /** | ||
*/ | ||
except: (f: readonly (Selection | FlatScope)[] | ((fields: Record<Selection | FlatScope, SafeString>) => ReadonlyArray<SafeString> | SafeString)) => SelectStatement<Selection, Alias, Scope, FlatScope>; | ||
/** | ||
* @since 2.0.0 | ||
*/ | ||
replace: (_: (f: Record<Selection | FlatScope, SafeString> & SelectionOfScope<Scope> & NoSelectFieldsCompileError) => ReplaceT<Selection>) => SelectStatement<Selection, Alias, Scope, FlatScope>; | ||
@@ -47,0 +52,0 @@ }; |
@@ -118,2 +118,6 @@ var __extends = (this && this.__extends) || (function () { | ||
}; | ||
this.setExcept = function (except) { | ||
_this.__props = __assign(__assign({}, _this.__props), { except: except }); | ||
return _this; | ||
}; | ||
this.setHaving = function (having) { | ||
@@ -155,2 +159,8 @@ _this.__props = __assign(__assign({}, _this.__props), { having: having }); | ||
*/ | ||
except: function (f) { | ||
return _this.copy().setExcept(__spreadArray(__spreadArray([], _this.__props.except, true), makeArray(consumeArrayCallback(f, _this.__props.scope)), true)); | ||
}, | ||
/** | ||
* @since 2.0.0 | ||
*/ | ||
replace: function (_) { | ||
@@ -246,2 +256,3 @@ return _this.copy().setReplace(__spreadArray(__spreadArray([], _this.__props.replace, true), consumeReplaceCallback(_, _this.__props.scope), true)); | ||
prewhere: [], | ||
except: [], | ||
having: [], | ||
@@ -268,2 +279,3 @@ distinct: false, | ||
prewhere: [], | ||
except: [], | ||
having: [], | ||
@@ -292,2 +304,3 @@ distinct: false, | ||
prewhere: [], | ||
except: [], | ||
having: [], | ||
@@ -294,0 +307,0 @@ distinct: false, |
@@ -185,2 +185,6 @@ var __spreadArray = (this && this.__spreadArray) || function (to, from, pack) { | ||
: ""; | ||
var vs = selectStatement.__props.except | ||
.map(function (it) { return it.content; }) | ||
.join(", "); | ||
var except = selectStatement.__props.except.length > 0 ? "EXCEPT (".concat(vs, ")") : ""; | ||
var from = selectStatement.__props.from != null | ||
@@ -204,2 +208,3 @@ ? "FROM ".concat(printInternal(selectStatement.__props.from, true)) | ||
selection, | ||
except, | ||
replace, | ||
@@ -206,0 +211,0 @@ from, |
@@ -25,2 +25,3 @@ import { SafeString } from "../safe-string"; | ||
private setPrewhere; | ||
private setExcept; | ||
private setHaving; | ||
@@ -45,2 +46,6 @@ /** | ||
*/ | ||
except: (f: readonly (Selection | FlatScope)[] | ((fields: Record<Selection | FlatScope, SafeString>) => ReadonlyArray<SafeString> | SafeString)) => SelectStatement<Selection, Alias, Scope, FlatScope>; | ||
/** | ||
* @since 2.0.0 | ||
*/ | ||
replace: (_: (f: Record<Selection | FlatScope, SafeString> & SelectionOfScope<Scope> & NoSelectFieldsCompileError) => ReplaceT<Selection>) => SelectStatement<Selection, Alias, Scope, FlatScope>; | ||
@@ -47,0 +52,0 @@ }; |
@@ -121,2 +121,6 @@ "use strict"; | ||
}; | ||
this.setExcept = function (except) { | ||
_this.__props = __assign(__assign({}, _this.__props), { except: except }); | ||
return _this; | ||
}; | ||
this.setHaving = function (having) { | ||
@@ -158,2 +162,8 @@ _this.__props = __assign(__assign({}, _this.__props), { having: having }); | ||
*/ | ||
except: function (f) { | ||
return _this.copy().setExcept(__spreadArray(__spreadArray([], _this.__props.except, true), (0, utils_1.makeArray)((0, consume_fields_1.consumeArrayCallback)(f, _this.__props.scope)), true)); | ||
}, | ||
/** | ||
* @since 2.0.0 | ||
*/ | ||
replace: function (_) { | ||
@@ -249,2 +259,3 @@ return _this.copy().setReplace(__spreadArray(__spreadArray([], _this.__props.replace, true), (0, consume_fields_1.consumeReplaceCallback)(_, _this.__props.scope), true)); | ||
prewhere: [], | ||
except: [], | ||
having: [], | ||
@@ -271,2 +282,3 @@ distinct: false, | ||
prewhere: [], | ||
except: [], | ||
having: [], | ||
@@ -295,2 +307,3 @@ distinct: false, | ||
prewhere: [], | ||
except: [], | ||
having: [], | ||
@@ -297,0 +310,0 @@ distinct: false, |
@@ -189,2 +189,6 @@ "use strict"; | ||
: ""; | ||
var vs = selectStatement.__props.except | ||
.map(function (it) { return it.content; }) | ||
.join(", "); | ||
var except = selectStatement.__props.except.length > 0 ? "EXCEPT (".concat(vs, ")") : ""; | ||
var from = selectStatement.__props.from != null | ||
@@ -208,2 +212,3 @@ ? "FROM ".concat(printInternal(selectStatement.__props.from, true)) | ||
selection, | ||
except, | ||
replace, | ||
@@ -210,0 +215,0 @@ from, |
{ | ||
"name": "sql-select-ts", | ||
"version": "2.0.3", | ||
"version": "2.0.4", | ||
"description": "A modern, database-agnostic, composable SELECT query builder with great typescript support.", | ||
@@ -5,0 +5,0 @@ "main": "lib/index.js", |
220541
5693