@entity-access/entity-access 1.0.344 → 1.0.346
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/compiler/postgres/PostgreSqlMethodTransformer.d.ts.map +1 -1
- package/dist/compiler/postgres/PostgreSqlMethodTransformer.js +5 -0
- package/dist/compiler/postgres/PostgreSqlMethodTransformer.js.map +1 -1
- package/dist/compiler/sql-server/SqlServerSqlMethodTransformer.d.ts.map +1 -1
- package/dist/compiler/sql-server/SqlServerSqlMethodTransformer.js +5 -0
- package/dist/compiler/sql-server/SqlServerSqlMethodTransformer.js.map +1 -1
- package/dist/query/ast/DebugStringVisitor.d.ts +2 -1
- package/dist/query/ast/DebugStringVisitor.d.ts.map +1 -1
- package/dist/query/ast/DebugStringVisitor.js +3 -0
- package/dist/query/ast/DebugStringVisitor.js.map +1 -1
- package/dist/query/ast/ExpressionToSql.d.ts +2 -1
- package/dist/query/ast/ExpressionToSql.d.ts.map +1 -1
- package/dist/query/ast/ExpressionToSql.js +3 -0
- package/dist/query/ast/ExpressionToSql.js.map +1 -1
- package/dist/query/ast/Expressions.d.ts +5 -1
- package/dist/query/ast/Expressions.d.ts.map +1 -1
- package/dist/query/ast/Expressions.js +6 -0
- package/dist/query/ast/Expressions.js.map +1 -1
- package/dist/query/ast/Visitor.d.ts +2 -1
- package/dist/query/ast/Visitor.d.ts.map +1 -1
- package/dist/query/ast/Visitor.js +5 -0
- package/dist/query/ast/Visitor.js.map +1 -1
- package/dist/query/parser/ArrowToExpression.d.ts.map +1 -1
- package/dist/query/parser/ArrowToExpression.js +5 -1
- package/dist/query/parser/ArrowToExpression.js.map +1 -1
- package/dist/query/parser/Restructure.d.ts.map +1 -1
- package/dist/query/parser/Restructure.js +5 -0
- package/dist/query/parser/Restructure.js.map +1 -1
- package/dist/sql/ISql.d.ts +6 -0
- package/dist/sql/ISql.d.ts.map +1 -1
- package/dist/sql/ISql.js +2 -0
- package/dist/sql/ISql.js.map +1 -1
- package/dist/tests/expressions/simple/parse-complex.d.ts +2 -0
- package/dist/tests/expressions/simple/parse-complex.d.ts.map +1 -0
- package/dist/tests/expressions/simple/parse-complex.js +11 -0
- package/dist/tests/expressions/simple/parse-complex.js.map +1 -0
- package/dist/tsconfig.tsbuildinfo +1 -1
- package/package.json +2 -2
- package/src/compiler/postgres/PostgreSqlMethodTransformer.ts +5 -0
- package/src/compiler/sql-server/SqlServerSqlMethodTransformer.ts +5 -0
- package/src/query/ast/DebugStringVisitor.ts +6 -1
- package/src/query/ast/ExpressionToSql.ts +5 -1
- package/src/query/ast/Expressions.ts +6 -0
- package/src/query/ast/Visitor.ts +6 -1
- package/src/query/parser/ArrowToExpression.ts +5 -1
- package/src/query/parser/Restructure.ts +5 -0
- package/src/sql/ISql.ts +5 -1
- package/src/tests/expressions/simple/parse-complex.ts +20 -0
package/src/sql/ISql.ts
CHANGED
|
@@ -1,5 +1,7 @@
|
|
|
1
1
|
import DateTime from "../types/DateTime.js";
|
|
2
2
|
|
|
3
|
+
class GUID {}
|
|
4
|
+
|
|
3
5
|
export interface ISql {
|
|
4
6
|
|
|
5
7
|
in<T>(a: T, array: T[]): boolean;
|
|
@@ -19,11 +21,13 @@ export interface ISql {
|
|
|
19
21
|
asDecimal(a: any): number;
|
|
20
22
|
asBoolean(a: any): boolean;
|
|
21
23
|
},
|
|
24
|
+
crypto: {
|
|
25
|
+
randomUUID(): GUID
|
|
26
|
+
},
|
|
22
27
|
math: {
|
|
23
28
|
min<T>(... a: T[]): T,
|
|
24
29
|
max<T>(... a: T[]): T,
|
|
25
30
|
},
|
|
26
|
-
|
|
27
31
|
text: {
|
|
28
32
|
concat(... fragments: string[]): string;
|
|
29
33
|
concatImmutable(... fragments: string[]): string;
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import assert from "assert";
|
|
2
|
+
import Sql from "../../../sql/Sql.js";
|
|
3
|
+
import QueryCompiler from "../../../compiler/QueryCompiler.js";
|
|
4
|
+
|
|
5
|
+
export default function () {
|
|
6
|
+
|
|
7
|
+
const compiler = QueryCompiler.instance;
|
|
8
|
+
|
|
9
|
+
const name = "Akash";
|
|
10
|
+
|
|
11
|
+
let r = compiler.execute({ name }, (p) => (x) => x.id ? 1 : -1);
|
|
12
|
+
assert.equal("(CASE WHEN x.id THEN 1 ELSE -1 END)", r.text);
|
|
13
|
+
|
|
14
|
+
r = compiler.execute({ name }, (p) => (x) => x.id ? 1 : -(5*1));
|
|
15
|
+
assert.equal("(CASE WHEN x.id THEN 1 ELSE (-5 * 1) END)", r.text);
|
|
16
|
+
|
|
17
|
+
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
type KeyCode = { name: string, code: number, key: string };
|