@malloydata/malloy 0.0.10-dev221124165006 → 0.0.10-dev221128232158
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/dialect/dialect.d.ts +1 -0
- package/dist/dialect/dialect.js +2 -0
- package/dist/dialect/duckdb.d.ts +1 -0
- package/dist/dialect/duckdb.js +3 -0
- package/dist/dialect/postgres.d.ts +1 -0
- package/dist/dialect/postgres.js +3 -0
- package/dist/dialect/standardsql.d.ts +1 -0
- package/dist/dialect/standardsql.js +4 -0
- package/dist/lang/ast/ast-expr.d.ts +2 -2
- package/dist/lang/ast/ast-expr.js +14 -3
- package/dist/model/malloy_query.js +2 -0
- package/dist/model/malloy_types.d.ts +5 -1
- package/package.json +1 -1
|
@@ -54,6 +54,7 @@ export declare abstract class Dialect {
|
|
|
54
54
|
ignoreInProject(_fieldName: string): boolean;
|
|
55
55
|
abstract sqlCast(cast: TypecastFragment): Expr;
|
|
56
56
|
abstract sqlLiteralTime(timeString: string, type: TimeFieldType, timezone: string): string;
|
|
57
|
+
abstract sqlLiteralString(literak: string): string;
|
|
57
58
|
abstract sqlRegexpMatch(expr: Expr, regex: string): Expr;
|
|
58
59
|
getFunctionInfo(functionName: string): FunctionInfo | undefined;
|
|
59
60
|
dialectExpr(df: DialectFragment): Expr;
|
package/dist/dialect/dialect.js
CHANGED
package/dist/dialect/duckdb.d.ts
CHANGED
|
@@ -46,4 +46,5 @@ export declare class DuckDBDialect extends Dialect {
|
|
|
46
46
|
sqlSumDistinct(key: string, value: string): string;
|
|
47
47
|
sqlSampleTable(tableSQL: string, sample: Sampling | undefined): string;
|
|
48
48
|
sqlOrderBy(orderTerms: string[]): string;
|
|
49
|
+
sqlLiteralString(literal: string): string;
|
|
49
50
|
}
|
package/dist/dialect/duckdb.js
CHANGED
|
@@ -342,6 +342,9 @@ class DuckDBDialect extends dialect_1.Dialect {
|
|
|
342
342
|
sqlOrderBy(orderTerms) {
|
|
343
343
|
return `ORDER BY ${orderTerms.map((t) => `${t} NULLS LAST`).join(",")}`;
|
|
344
344
|
}
|
|
345
|
+
sqlLiteralString(literal) {
|
|
346
|
+
return "'" + literal.replace(/'/g, "''") + "'";
|
|
347
|
+
}
|
|
345
348
|
}
|
|
346
349
|
exports.DuckDBDialect = DuckDBDialect;
|
|
347
350
|
//# sourceMappingURL=duckdb.js.map
|
|
@@ -46,4 +46,5 @@ export declare class PostgresDialect extends Dialect {
|
|
|
46
46
|
sqlSumDistinct(key: string, value: string): string;
|
|
47
47
|
sqlSampleTable(tableSQL: string, sample: Sampling | undefined): string;
|
|
48
48
|
sqlOrderBy(orderTerms: string[]): string;
|
|
49
|
+
sqlLiteralString(literal: string): string;
|
|
49
50
|
}
|
package/dist/dialect/postgres.js
CHANGED
|
@@ -310,6 +310,9 @@ class PostgresDialect extends dialect_1.Dialect {
|
|
|
310
310
|
sqlOrderBy(orderTerms) {
|
|
311
311
|
return `ORDER BY ${orderTerms.map((t) => `${t} NULLS LAST`).join(",")}`;
|
|
312
312
|
}
|
|
313
|
+
sqlLiteralString(literal) {
|
|
314
|
+
return "'" + literal.replace(/'/g, "''") + "'";
|
|
315
|
+
}
|
|
313
316
|
}
|
|
314
317
|
exports.PostgresDialect = PostgresDialect;
|
|
315
318
|
//# sourceMappingURL=postgres.js.map
|
|
@@ -43,4 +43,5 @@ export declare class StandardSQLDialect extends Dialect {
|
|
|
43
43
|
sqlLiteralTime(timeString: string, type: "date" | "timestamp", timezone: string): string;
|
|
44
44
|
sqlMeasureTime(from: TimeValue, to: TimeValue, units: string): Expr;
|
|
45
45
|
sqlSampleTable(tableSQL: string, sample: Sampling | undefined): string;
|
|
46
|
+
sqlLiteralString(literal: string): string;
|
|
46
47
|
}
|
|
@@ -357,6 +357,10 @@ ${(0, utils_1.indent)(sql)}
|
|
|
357
357
|
}
|
|
358
358
|
return tableSQL;
|
|
359
359
|
}
|
|
360
|
+
sqlLiteralString(literal) {
|
|
361
|
+
const noVirgule = literal.replace(/\\/g, "\\\\");
|
|
362
|
+
return "'" + noVirgule.replace(/'/g, "\\'") + "'";
|
|
363
|
+
}
|
|
360
364
|
}
|
|
361
365
|
exports.StandardSQLDialect = StandardSQLDialect;
|
|
362
366
|
//# sourceMappingURL=standardsql.js.map
|
|
@@ -71,9 +71,9 @@ export declare class FieldDeclaration extends MalloyElement {
|
|
|
71
71
|
export declare class TypeMistmatch extends Error {
|
|
72
72
|
}
|
|
73
73
|
export declare class ExprString extends ExpressionDef {
|
|
74
|
-
readonly value: string;
|
|
75
74
|
elementType: string;
|
|
76
|
-
|
|
75
|
+
value: string;
|
|
76
|
+
constructor(src: string);
|
|
77
77
|
getExpression(_fs: FieldSpace): ExprValue;
|
|
78
78
|
}
|
|
79
79
|
export declare class ExprNumber extends ExpressionDef {
|
|
@@ -221,13 +221,24 @@ class TypeMistmatch extends Error {
|
|
|
221
221
|
}
|
|
222
222
|
exports.TypeMistmatch = TypeMistmatch;
|
|
223
223
|
class ExprString extends ExpressionDef {
|
|
224
|
-
constructor(
|
|
224
|
+
constructor(src) {
|
|
225
225
|
super();
|
|
226
|
-
this.value = value;
|
|
227
226
|
this.elementType = "string literal";
|
|
227
|
+
const bareStr = src.slice(1, -1);
|
|
228
|
+
const val = bareStr.replace(/\\(.)/g, "$1");
|
|
229
|
+
this.value = val;
|
|
228
230
|
}
|
|
229
231
|
getExpression(_fs) {
|
|
230
|
-
return {
|
|
232
|
+
return {
|
|
233
|
+
...index_1.FT.stringT,
|
|
234
|
+
value: [
|
|
235
|
+
{
|
|
236
|
+
type: "dialect",
|
|
237
|
+
function: "stringLiteral",
|
|
238
|
+
literal: this.value,
|
|
239
|
+
},
|
|
240
|
+
],
|
|
241
|
+
};
|
|
231
242
|
}
|
|
232
243
|
}
|
|
233
244
|
exports.ExprString = ExprString;
|
|
@@ -184,7 +184,11 @@ export interface TimeLiteralFragment extends DialectFragmentBase {
|
|
|
184
184
|
literalType: TimeFieldType;
|
|
185
185
|
timezone: string;
|
|
186
186
|
}
|
|
187
|
-
export
|
|
187
|
+
export interface StringLiteralFragment extends DialectFragmentBase {
|
|
188
|
+
function: "stringLiteral";
|
|
189
|
+
literal: string;
|
|
190
|
+
}
|
|
191
|
+
export declare type DialectFragment = DivFragment | TimeLiteralFragment | NowFragment | TimeDeltaFragment | TimeDiffFragment | TimeTruncFragment | TypecastFragment | TimeExtractFragment | StringLiteralFragment | RegexpMatchFragment;
|
|
188
192
|
export declare type Fragment = string | ApplyFragment | ApplyValueFragment | FieldFragment | ParameterFragment | FilterFragment | AggregateFragment | UngroupFragment | DialectFragment;
|
|
189
193
|
export declare type Expr = Fragment[];
|
|
190
194
|
export interface TypedValue {
|