rado 0.2.43 → 0.2.44
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { EV } from '../Expr.js';
|
|
2
|
+
import { OrderBy } from '../OrderBy.js';
|
|
2
3
|
import { Query, QueryData } from '../Query.js';
|
|
3
4
|
export declare class Delete extends Query<{
|
|
4
5
|
rowsAffected: number;
|
|
@@ -6,6 +7,7 @@ export declare class Delete extends Query<{
|
|
|
6
7
|
[Query.Data]: QueryData.Delete;
|
|
7
8
|
constructor(query: QueryData.Delete);
|
|
8
9
|
where(...where: Array<EV<boolean>>): Delete;
|
|
10
|
+
orderBy(...orderBy: Array<OrderBy>): Delete;
|
|
9
11
|
take(limit: number | undefined): Delete;
|
|
10
12
|
skip(offset: number | undefined): Delete;
|
|
11
13
|
}
|
package/dist/lib/Formatter.js
CHANGED
|
@@ -177,15 +177,15 @@ class Formatter {
|
|
|
177
177
|
this.formatValue({ ...ctx, formatAsInsert: true }, input);
|
|
178
178
|
}
|
|
179
179
|
this.formatWhere(ctx, query.where);
|
|
180
|
+
this.formatOrderBy(ctx, query.orderBy);
|
|
180
181
|
this.formatLimit(ctx, query);
|
|
181
182
|
return stmt;
|
|
182
183
|
}
|
|
183
184
|
formatDelete(ctx, query) {
|
|
184
185
|
const { stmt } = ctx;
|
|
185
186
|
stmt.add("DELETE FROM").addIdentifier(query.table.name);
|
|
186
|
-
stmt.space();
|
|
187
187
|
this.formatWhere(ctx, query.where);
|
|
188
|
-
|
|
188
|
+
this.formatOrderBy(ctx, query.orderBy);
|
|
189
189
|
this.formatLimit(ctx, query);
|
|
190
190
|
return stmt;
|
|
191
191
|
}
|
package/dist/lib/Statement.d.ts
CHANGED
package/dist/lib/Statement.js
CHANGED
|
@@ -66,9 +66,12 @@ class Statement {
|
|
|
66
66
|
/**
|
|
67
67
|
* Adds a newline
|
|
68
68
|
*/
|
|
69
|
-
newline() {
|
|
69
|
+
newline(spaceRequired = true) {
|
|
70
70
|
if (this.options.skipNewlines)
|
|
71
|
-
|
|
71
|
+
if (spaceRequired)
|
|
72
|
+
return this.space();
|
|
73
|
+
else
|
|
74
|
+
return this;
|
|
72
75
|
return this.raw(NEWLINE + this.currentIndent);
|
|
73
76
|
}
|
|
74
77
|
/**
|
|
@@ -113,13 +116,13 @@ class Statement {
|
|
|
113
116
|
* Opens a parenthesis and indents the next line
|
|
114
117
|
*/
|
|
115
118
|
openParenthesis() {
|
|
116
|
-
return this.raw("(").indent().newline();
|
|
119
|
+
return this.raw("(").indent().newline(false);
|
|
117
120
|
}
|
|
118
121
|
/**
|
|
119
122
|
* Closes a parenthesis and dedents the next line
|
|
120
123
|
*/
|
|
121
124
|
closeParenthesis() {
|
|
122
|
-
return this.dedent().newline().raw(")");
|
|
125
|
+
return this.dedent().newline(false).raw(")");
|
|
123
126
|
}
|
|
124
127
|
/**
|
|
125
128
|
* Adds parenthesis on start and end, and a seperator to the output on
|
|
@@ -138,7 +141,7 @@ class Statement {
|
|
|
138
141
|
*separate(parts, separator = SEPARATE) {
|
|
139
142
|
for (let i = 0; i < parts.length; i++) {
|
|
140
143
|
if (i > 0)
|
|
141
|
-
this.raw(separator).newline();
|
|
144
|
+
this.raw(separator).newline(false);
|
|
142
145
|
yield parts[i];
|
|
143
146
|
}
|
|
144
147
|
}
|