rado 0.2.41 → 0.2.42
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.
package/dist/define/Expr.d.ts
CHANGED
|
@@ -170,7 +170,7 @@ export declare namespace Expr {
|
|
|
170
170
|
const IsExpr: unique symbol;
|
|
171
171
|
const ToExpr: unique symbol;
|
|
172
172
|
const NULL: Expr<null>;
|
|
173
|
-
function value<T>(value: T): Expr<T>;
|
|
173
|
+
function value<T>(value: T, inline?: boolean): Expr<T>;
|
|
174
174
|
function get<T = any>(expr: ObjectExpr, field: string): Expr<T>;
|
|
175
175
|
function create<T>(input: EV<T>): Expr<T>;
|
|
176
176
|
function and(...conditions: Array<EV<boolean>>): Expr<boolean>;
|
package/dist/define/Expr.js
CHANGED
|
@@ -392,8 +392,8 @@ class Expr {
|
|
|
392
392
|
Expr2.IsExpr = Symbol("Expr.IsExpr");
|
|
393
393
|
Expr2.ToExpr = Symbol("Expr.ToExpr");
|
|
394
394
|
Expr2.NULL = create(null);
|
|
395
|
-
function value(value2) {
|
|
396
|
-
return new Expr2(new ExprData.Param(new ParamData.Value(value2)));
|
|
395
|
+
function value(value2, inline = false) {
|
|
396
|
+
return new Expr2(new ExprData.Param(new ParamData.Value(value2, inline)));
|
|
397
397
|
}
|
|
398
398
|
Expr2.value = value;
|
|
399
399
|
function get(expr, field) {
|
package/dist/define/Param.d.ts
CHANGED
package/dist/define/Param.js
CHANGED
|
@@ -6,8 +6,9 @@ var ParamType = /* @__PURE__ */ ((ParamType2) => {
|
|
|
6
6
|
var ParamData;
|
|
7
7
|
((ParamData2) => {
|
|
8
8
|
class Value {
|
|
9
|
-
constructor(value) {
|
|
9
|
+
constructor(value, inline = false) {
|
|
10
10
|
this.value = value;
|
|
11
|
+
this.inline = inline;
|
|
11
12
|
}
|
|
12
13
|
type = "ParamData.Value" /* Value */;
|
|
13
14
|
}
|
package/dist/define/Sql.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { Query } from './Query.js';
|
|
2
2
|
export declare function sql<T>(strings: TemplateStringsArray, ...params: Array<unknown>): Query<T>;
|
|
3
3
|
export declare namespace sql {
|
|
4
|
-
function all<T>(strings: TemplateStringsArray, ...params: Array<unknown>): Query<T
|
|
5
|
-
function get<T>(strings: TemplateStringsArray, ...params: Array<unknown>): Query<T>;
|
|
4
|
+
function all<T = unknown>(strings: TemplateStringsArray, ...params: Array<unknown>): Query<Array<T>>;
|
|
5
|
+
function get<T = unknown>(strings: TemplateStringsArray, ...params: Array<unknown>): Query<T>;
|
|
6
6
|
}
|
package/dist/lib/Formatter.d.ts
CHANGED
|
@@ -75,7 +75,7 @@ export declare abstract class Formatter implements Sanitizer {
|
|
|
75
75
|
formatSelection(ctx: FormatContext, selection: ExprData, formatSubject?: FormatSubject): Statement;
|
|
76
76
|
formatString(ctx: FormatContext, input: string): Statement;
|
|
77
77
|
formatInlineValue(ctx: FormatContext, rawValue: any): Statement;
|
|
78
|
-
formatValue(ctx: FormatContext, rawValue: any): Statement;
|
|
78
|
+
formatValue(ctx: FormatContext, rawValue: any, inline?: boolean): Statement;
|
|
79
79
|
formatExprJson(ctx: FormatContext, expr: ExprData): Statement;
|
|
80
80
|
formatExprValue(ctx: FormatContext, expr: ExprData): Statement;
|
|
81
81
|
formatExpr(ctx: FormatContext, expr: ExprData): Statement;
|
package/dist/lib/Formatter.js
CHANGED
|
@@ -502,8 +502,9 @@ class Formatter {
|
|
|
502
502
|
return this.formatString(ctx, JSON.stringify(rawValue));
|
|
503
503
|
}
|
|
504
504
|
}
|
|
505
|
-
formatValue(ctx, rawValue) {
|
|
505
|
+
formatValue(ctx, rawValue, inline = false) {
|
|
506
506
|
const { stmt, formatAsJson, formatAsInsert, forceInline } = ctx;
|
|
507
|
+
const inlineValue = inline || forceInline;
|
|
507
508
|
const asJson = formatAsJson || formatAsInsert;
|
|
508
509
|
switch (true) {
|
|
509
510
|
case (rawValue === null || rawValue === void 0):
|
|
@@ -519,7 +520,7 @@ class Formatter {
|
|
|
519
520
|
stmt.closeParenthesis();
|
|
520
521
|
return stmt;
|
|
521
522
|
case (typeof rawValue === "string" || typeof rawValue === "number"):
|
|
522
|
-
if (
|
|
523
|
+
if (inlineValue)
|
|
523
524
|
return stmt.raw(this.escapeValue(rawValue));
|
|
524
525
|
return stmt.value(rawValue);
|
|
525
526
|
default:
|
|
@@ -527,7 +528,7 @@ class Formatter {
|
|
|
527
528
|
stmt.raw("json");
|
|
528
529
|
stmt.openParenthesis();
|
|
529
530
|
}
|
|
530
|
-
if (
|
|
531
|
+
if (inlineValue)
|
|
531
532
|
this.formatString(ctx, JSON.stringify(rawValue));
|
|
532
533
|
else
|
|
533
534
|
stmt.value(JSON.stringify(rawValue));
|
|
@@ -594,7 +595,7 @@ class Formatter {
|
|
|
594
595
|
const { stmt } = ctx;
|
|
595
596
|
switch (expr.param.type) {
|
|
596
597
|
case ParamType.Value:
|
|
597
|
-
return this.formatValue(ctx, expr.param.value);
|
|
598
|
+
return this.formatValue(ctx, expr.param.value, expr.param.inline);
|
|
598
599
|
case ParamType.Named:
|
|
599
600
|
return stmt.param(expr.param);
|
|
600
601
|
}
|