rado 0.2.30 → 0.2.32
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/Column.d.ts +3 -3
- package/dist/define/Column.js +13 -14
- package/dist/define/Expr.d.ts +10 -10
- package/dist/define/Expr.js +3 -4
- package/dist/define/Fields.d.ts +1 -1
- package/dist/define/Functions.d.ts +1 -1
- package/dist/define/Functions.js +1 -2
- package/dist/define/Index.d.ts +1 -1
- package/dist/define/Index.js +2 -3
- package/dist/define/Ops.d.ts +11 -11
- package/dist/define/Ops.js +3 -4
- package/dist/define/OrderBy.d.ts +1 -1
- package/dist/define/OrderBy.js +0 -1
- package/dist/define/Param.js +0 -1
- package/dist/define/Query.d.ts +9 -9
- package/dist/define/Query.js +3 -4
- package/dist/define/Schema.d.ts +3 -3
- package/dist/define/Schema.js +0 -1
- package/dist/define/Selection.d.ts +3 -3
- package/dist/define/Selection.js +0 -1
- package/dist/define/Sql.d.ts +1 -1
- package/dist/define/Sql.js +0 -1
- package/dist/define/Table.d.ts +9 -9
- package/dist/define/Table.js +3 -4
- package/dist/define/Target.d.ts +3 -3
- package/dist/define/Target.js +0 -1
- package/dist/define/VirtualTable.d.ts +11 -11
- package/dist/define/VirtualTable.js +1 -2
- package/dist/define/query/Batch.d.ts +1 -1
- package/dist/define/query/Batch.js +2 -3
- package/dist/define/query/CreateTable.d.ts +2 -2
- package/dist/define/query/CreateTable.js +2 -3
- package/dist/define/query/Delete.d.ts +2 -2
- package/dist/define/query/Delete.js +2 -3
- package/dist/define/query/Insert.d.ts +5 -5
- package/dist/define/query/Insert.js +6 -7
- package/dist/define/query/Select.d.ts +31 -31
- package/dist/define/query/Select.js +28 -31
- package/dist/define/query/TableSelect.d.ts +11 -11
- package/dist/define/query/TableSelect.js +3 -4
- package/dist/define/query/Union.d.ts +9 -9
- package/dist/define/query/Union.js +7 -8
- package/dist/define/query/Update.d.ts +3 -3
- package/dist/define/query/Update.js +2 -3
- package/dist/driver/better-sqlite3.d.ts +4 -4
- package/dist/driver/better-sqlite3.js +4 -5
- package/dist/driver/bun-sqlite.d.ts +4 -4
- package/dist/driver/bun-sqlite.js +6 -7
- package/dist/driver/sql.js.d.ts +4 -4
- package/dist/driver/sql.js.js +4 -5
- package/dist/driver/sqlite3.d.ts +5 -5
- package/dist/driver/sqlite3.js +4 -5
- package/dist/index.d.ts +21 -21
- package/dist/index.js +0 -1
- package/dist/lib/Driver.d.ts +10 -10
- package/dist/lib/Driver.js +10 -11
- package/dist/lib/Formatter.d.ts +8 -8
- package/dist/lib/Formatter.js +11 -8
- package/dist/lib/SqlError.js +2 -3
- package/dist/lib/Statement.d.ts +2 -2
- package/dist/lib/Statement.js +6 -7
- package/dist/sqlite/SqliteFormatter.d.ts +3 -3
- package/dist/sqlite/SqliteFormatter.js +8 -9
- package/dist/sqlite/SqliteFunctions.d.ts +3 -3
- package/dist/sqlite/SqliteFunctions.js +2 -3
- package/dist/sqlite/SqliteSchema.d.ts +3 -3
- package/dist/sqlite/SqliteSchema.js +0 -1
- package/dist/sqlite.d.ts +2 -2
- package/dist/sqlite.js +0 -1
- package/dist/util/Alias.js +0 -1
- package/dist/util/Callable.js +3 -4
- package/package.json +16 -5
package/dist/define/Column.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { Callable } from '../util/Callable';
|
|
2
|
-
import { EV, Expr, ExprData } from './Expr';
|
|
3
|
-
import { Fields } from './Fields';
|
|
1
|
+
import { Callable } from '../util/Callable.js';
|
|
2
|
+
import { EV, Expr, ExprData } from './Expr.js';
|
|
3
|
+
import { Fields } from './Fields.js';
|
|
4
4
|
export declare enum ColumnType {
|
|
5
5
|
String = "String",
|
|
6
6
|
Integer = "Integer",
|
package/dist/define/Column.js
CHANGED
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
// src/define/Column.ts
|
|
2
1
|
import { Callable } from "../util/Callable.js";
|
|
3
2
|
import { Expr, ExprData } from "./Expr.js";
|
|
4
3
|
var ColumnType = /* @__PURE__ */ ((ColumnType2) => {
|
|
@@ -18,7 +17,7 @@ var Column;
|
|
|
18
17
|
}
|
|
19
18
|
Column2.isColumn = isColumn;
|
|
20
19
|
})(Column || (Column = {}));
|
|
21
|
-
|
|
20
|
+
class ValueColumn extends Callable {
|
|
22
21
|
[Column.Data];
|
|
23
22
|
constructor(data) {
|
|
24
23
|
super(() => this);
|
|
@@ -54,17 +53,17 @@ var ValueColumn = class extends Callable {
|
|
|
54
53
|
defaultValue: createDefaultValue(value)
|
|
55
54
|
});
|
|
56
55
|
}
|
|
57
|
-
}
|
|
56
|
+
}
|
|
58
57
|
function createDefaultValue(value) {
|
|
59
58
|
return typeof value === "function" && !Expr.isExpr(value) ? () => ExprData.create(value()) : ExprData.create(value);
|
|
60
59
|
}
|
|
61
|
-
|
|
60
|
+
class OptionalColumn extends ValueColumn {
|
|
62
61
|
[Column.IsOptional];
|
|
63
|
-
}
|
|
64
|
-
|
|
62
|
+
}
|
|
63
|
+
class PrimaryColumn extends ValueColumn {
|
|
65
64
|
[Column.IsPrimary];
|
|
66
|
-
}
|
|
67
|
-
|
|
65
|
+
}
|
|
66
|
+
class ObjectColumn extends Callable {
|
|
68
67
|
[Column.Data];
|
|
69
68
|
constructor(data) {
|
|
70
69
|
super(() => this);
|
|
@@ -82,11 +81,11 @@ var ObjectColumn = class extends Callable {
|
|
|
82
81
|
defaultValue: createDefaultValue(value)
|
|
83
82
|
});
|
|
84
83
|
}
|
|
85
|
-
}
|
|
86
|
-
|
|
84
|
+
}
|
|
85
|
+
class OptionalObjectColumn extends ObjectColumn {
|
|
87
86
|
[Column.IsOptional];
|
|
88
|
-
}
|
|
89
|
-
|
|
87
|
+
}
|
|
88
|
+
class UnTyped extends Callable {
|
|
90
89
|
[Column.Data];
|
|
91
90
|
constructor(data = {}) {
|
|
92
91
|
super((name) => {
|
|
@@ -145,8 +144,8 @@ var UnTyped = class extends Callable {
|
|
|
145
144
|
type: "Json" /* Json */
|
|
146
145
|
});
|
|
147
146
|
}
|
|
148
|
-
}
|
|
149
|
-
|
|
147
|
+
}
|
|
148
|
+
const column = new UnTyped();
|
|
150
149
|
export {
|
|
151
150
|
Column,
|
|
152
151
|
ColumnType,
|
package/dist/define/Expr.d.ts
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
import { Fields } from './Fields';
|
|
2
|
-
import { OrderBy } from './OrderBy';
|
|
3
|
-
import { ParamData } from './Param';
|
|
4
|
-
import { QueryData } from './Query';
|
|
5
|
-
import { Selection } from './Selection';
|
|
6
|
-
import { Target } from './Target';
|
|
7
|
-
import {
|
|
1
|
+
import { Fields } from './Fields.js';
|
|
2
|
+
import { OrderBy } from './OrderBy.js';
|
|
3
|
+
import { ParamData } from './Param.js';
|
|
4
|
+
import { QueryData } from './Query.js';
|
|
5
|
+
import { Selection } from './Selection.js';
|
|
6
|
+
import { Target } from './Target.js';
|
|
7
|
+
import { Select, SelectFirst } from './query/Select.js';
|
|
8
8
|
export declare enum UnOpType {
|
|
9
9
|
Not = "Not",
|
|
10
10
|
IsNull = "IsNull"
|
|
@@ -127,13 +127,13 @@ export declare class Expr<T> {
|
|
|
127
127
|
not(): Expr<boolean>;
|
|
128
128
|
or(this: Expr<boolean>, that: EV<boolean>): Expr<boolean>;
|
|
129
129
|
and(this: Expr<boolean>, that: EV<boolean>): Expr<boolean>;
|
|
130
|
-
is(that: EV<T> |
|
|
130
|
+
is(that: EV<T> | SelectFirst<T>): Expr<boolean>;
|
|
131
131
|
isConstant(value: T): boolean;
|
|
132
132
|
isNot(that: EV<T>): Expr<boolean>;
|
|
133
133
|
isNull(): Expr<boolean>;
|
|
134
134
|
isNotNull(): Expr<boolean>;
|
|
135
|
-
isIn(that: EV<Array<T>> |
|
|
136
|
-
isNotIn(that: EV<Array<T>> |
|
|
135
|
+
isIn(that: EV<Array<T>> | Select<T>): Expr<boolean>;
|
|
136
|
+
isNotIn(that: EV<Array<T>> | Select<T>): Expr<boolean>;
|
|
137
137
|
isGreater(that: EV<any>): Expr<boolean>;
|
|
138
138
|
isGreaterOrEqual(that: EV<any>): Expr<boolean>;
|
|
139
139
|
isLess(that: EV<any>): Expr<boolean>;
|
package/dist/define/Expr.js
CHANGED
|
@@ -1,9 +1,8 @@
|
|
|
1
|
-
// src/define/Expr.ts
|
|
2
1
|
import { randomAlias } from "../util/Alias.js";
|
|
3
2
|
import { OrderDirection } from "./OrderBy.js";
|
|
4
3
|
import { ParamData, ParamType } from "./Param.js";
|
|
5
4
|
import { Target } from "./Target.js";
|
|
6
|
-
|
|
5
|
+
const { fromEntries, entries } = Object;
|
|
7
6
|
var UnOpType = /* @__PURE__ */ ((UnOpType2) => {
|
|
8
7
|
UnOpType2["Not"] = "Not";
|
|
9
8
|
UnOpType2["IsNull"] = "IsNull";
|
|
@@ -149,7 +148,7 @@ var ExprData;
|
|
|
149
148
|
}
|
|
150
149
|
ExprData2.create = create;
|
|
151
150
|
})(ExprData || (ExprData = {}));
|
|
152
|
-
|
|
151
|
+
class Expr {
|
|
153
152
|
constructor(expr) {
|
|
154
153
|
this[Expr.Data] = expr;
|
|
155
154
|
this[Expr.IsExpr] = true;
|
|
@@ -387,7 +386,7 @@ var Expr = class {
|
|
|
387
386
|
get(name) {
|
|
388
387
|
return new Expr(new ExprData.Field(this[Expr.Data], name));
|
|
389
388
|
}
|
|
390
|
-
}
|
|
389
|
+
}
|
|
391
390
|
((Expr2) => {
|
|
392
391
|
Expr2.Data = Symbol("Expr.Data");
|
|
393
392
|
Expr2.IsExpr = Symbol("Expr.IsExpr");
|
package/dist/define/Fields.d.ts
CHANGED
package/dist/define/Functions.js
CHANGED
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
// src/define/Functions.ts
|
|
2
1
|
import { Expr, ExprData } from "./Expr.js";
|
|
3
2
|
function get(target, method) {
|
|
4
3
|
if (method in target)
|
|
@@ -7,7 +6,7 @@ function get(target, method) {
|
|
|
7
6
|
return new Expr(new ExprData.Call(method, args.map(ExprData.create)));
|
|
8
7
|
};
|
|
9
8
|
}
|
|
10
|
-
|
|
9
|
+
const Functions = new Proxy(/* @__PURE__ */ Object.create(null), { get });
|
|
11
10
|
export {
|
|
12
11
|
Functions
|
|
13
12
|
};
|
package/dist/define/Index.d.ts
CHANGED
package/dist/define/Index.js
CHANGED
|
@@ -1,6 +1,5 @@
|
|
|
1
|
-
// src/define/Index.ts
|
|
2
1
|
import { ExprData } from "./Expr.js";
|
|
3
|
-
|
|
2
|
+
class Index {
|
|
4
3
|
constructor(data) {
|
|
5
4
|
this.data = data;
|
|
6
5
|
}
|
|
@@ -10,7 +9,7 @@ var Index = class {
|
|
|
10
9
|
where(where) {
|
|
11
10
|
return new Index({ ...this.data, where: ExprData.create(where) });
|
|
12
11
|
}
|
|
13
|
-
}
|
|
12
|
+
}
|
|
14
13
|
function index(...on) {
|
|
15
14
|
return new Index({ on: on.map(ExprData.create) });
|
|
16
15
|
}
|
package/dist/define/Ops.d.ts
CHANGED
|
@@ -1,15 +1,15 @@
|
|
|
1
|
-
import { Selection } from './Selection';
|
|
2
|
-
import { Table } from './Table';
|
|
3
|
-
import { Batch } from './query/Batch';
|
|
4
|
-
import { Delete } from './query/Delete';
|
|
5
|
-
import { Insert } from './query/Insert';
|
|
6
|
-
import {
|
|
7
|
-
import { RecursiveUnion } from './query/Union';
|
|
8
|
-
import { Update } from './query/Update';
|
|
9
|
-
export declare function withRecursive<Row>(initialSelect:
|
|
1
|
+
import { Selection } from './Selection.js';
|
|
2
|
+
import { Table } from './Table.js';
|
|
3
|
+
import { Batch } from './query/Batch.js';
|
|
4
|
+
import { Delete } from './query/Delete.js';
|
|
5
|
+
import { Insert } from './query/Insert.js';
|
|
6
|
+
import { Select } from './query/Select.js';
|
|
7
|
+
import { RecursiveUnion } from './query/Union.js';
|
|
8
|
+
import { Update } from './query/Update.js';
|
|
9
|
+
export declare function withRecursive<Row>(initialSelect: Select<Row>): RecursiveUnion<Row>;
|
|
10
10
|
export declare function alias<T extends Table<{}>>(table: T): Record<string, T>;
|
|
11
|
-
export declare function select<X extends Selection>(selection: X):
|
|
12
|
-
export declare function from<Row>(source: Table<Row> |
|
|
11
|
+
export declare function select<X extends Selection>(selection: X): Select<Selection.Infer<X>>;
|
|
12
|
+
export declare function from<Row>(source: Table<Row> | Select<Row>): Select<Row>;
|
|
13
13
|
export declare function update<Row>(table: Table<Row>): Update<Row>;
|
|
14
14
|
export declare function insertInto<Row>(table: Table<Row>): Insert<Row>;
|
|
15
15
|
export declare function deleteFrom<Row>(table: Table<Row>): Delete;
|
package/dist/define/Ops.js
CHANGED
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
// src/define/Ops.ts
|
|
2
1
|
import { ExprData } from "./Expr.js";
|
|
3
2
|
import { Query, QueryData } from "./Query.js";
|
|
4
3
|
import { Schema } from "./Schema.js";
|
|
@@ -7,7 +6,7 @@ import { Target } from "./Target.js";
|
|
|
7
6
|
import { Batch } from "./query/Batch.js";
|
|
8
7
|
import { Delete } from "./query/Delete.js";
|
|
9
8
|
import { Insert } from "./query/Insert.js";
|
|
10
|
-
import {
|
|
9
|
+
import { Select } from "./query/Select.js";
|
|
11
10
|
import { RecursiveUnion } from "./query/Union.js";
|
|
12
11
|
import { Update } from "./query/Update.js";
|
|
13
12
|
function withRecursive(initialSelect) {
|
|
@@ -21,7 +20,7 @@ function alias(table) {
|
|
|
21
20
|
});
|
|
22
21
|
}
|
|
23
22
|
function select(selection) {
|
|
24
|
-
return new
|
|
23
|
+
return new Select(
|
|
25
24
|
new QueryData.Select({
|
|
26
25
|
selection: ExprData.create(selection)
|
|
27
26
|
})
|
|
@@ -29,7 +28,7 @@ function select(selection) {
|
|
|
29
28
|
}
|
|
30
29
|
function from(source) {
|
|
31
30
|
const target = Query.isQuery(source) ? new Target.Query(source[Query.Data]) : new Target.Table(source[Table.Data]);
|
|
32
|
-
return new
|
|
31
|
+
return new Select(
|
|
33
32
|
new QueryData.Select({
|
|
34
33
|
from: target,
|
|
35
34
|
selection: new ExprData.Row(target)
|
package/dist/define/OrderBy.d.ts
CHANGED
package/dist/define/OrderBy.js
CHANGED
package/dist/define/Param.js
CHANGED
package/dist/define/Query.d.ts
CHANGED
|
@@ -1,12 +1,12 @@
|
|
|
1
|
-
import { Driver } from '../lib/Driver';
|
|
2
|
-
import { CompileOptions } from '../lib/Formatter';
|
|
3
|
-
import { ColumnData } from './Column';
|
|
4
|
-
import { EV, ExprData } from './Expr';
|
|
5
|
-
import { IndexData } from './Index';
|
|
6
|
-
import { OrderBy } from './OrderBy';
|
|
7
|
-
import { Selection } from './Selection';
|
|
8
|
-
import { TableData } from './Table';
|
|
9
|
-
import { Target } from './Target';
|
|
1
|
+
import { Driver } from '../lib/Driver.js';
|
|
2
|
+
import { CompileOptions } from '../lib/Formatter.js';
|
|
3
|
+
import { ColumnData } from './Column.js';
|
|
4
|
+
import { EV, ExprData } from './Expr.js';
|
|
5
|
+
import { IndexData } from './Index.js';
|
|
6
|
+
import { OrderBy } from './OrderBy.js';
|
|
7
|
+
import { Selection } from './Selection.js';
|
|
8
|
+
import { TableData } from './Table.js';
|
|
9
|
+
import { Target } from './Target.js';
|
|
10
10
|
export declare enum QueryType {
|
|
11
11
|
Insert = "QueryData.Insert",
|
|
12
12
|
Select = "QueryData.Select",
|
package/dist/define/Query.js
CHANGED
|
@@ -1,6 +1,5 @@
|
|
|
1
|
-
// src/define/Query.ts
|
|
2
1
|
import { Expr } from "./Expr.js";
|
|
3
|
-
|
|
2
|
+
const { assign } = Object;
|
|
4
3
|
var QueryType = /* @__PURE__ */ ((QueryType2) => {
|
|
5
4
|
QueryType2["Insert"] = "QueryData.Insert";
|
|
6
5
|
QueryType2["Select"] = "QueryData.Select";
|
|
@@ -98,7 +97,7 @@ var QueryData;
|
|
|
98
97
|
}
|
|
99
98
|
QueryData2.Raw = Raw;
|
|
100
99
|
})(QueryData || (QueryData = {}));
|
|
101
|
-
|
|
100
|
+
class Query {
|
|
102
101
|
constructor(query) {
|
|
103
102
|
this[Query.Data] = query;
|
|
104
103
|
}
|
|
@@ -127,7 +126,7 @@ var Query = class {
|
|
|
127
126
|
conditions.push(new Expr(query.where));
|
|
128
127
|
return query.with({ where: Expr.and(...conditions)[Expr.Data] });
|
|
129
128
|
}
|
|
130
|
-
}
|
|
129
|
+
}
|
|
131
130
|
((Query2) => {
|
|
132
131
|
Query2.Data = Symbol("Query.Data");
|
|
133
132
|
function isQuery(input) {
|
package/dist/define/Schema.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { Formatter } from '../lib/Formatter';
|
|
2
|
-
import { QueryData } from './Query';
|
|
3
|
-
import { Table, TableData } from './Table';
|
|
1
|
+
import { Formatter } from '../lib/Formatter.js';
|
|
2
|
+
import { QueryData } from './Query.js';
|
|
3
|
+
import { Table, TableData } from './Table.js';
|
|
4
4
|
export interface SchemaInstructions {
|
|
5
5
|
columns: Record<string, string>;
|
|
6
6
|
indexes: Record<string, string>;
|
package/dist/define/Schema.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import type { Expr } from './Expr';
|
|
2
|
-
import type {
|
|
3
|
-
type SelectionBase = unknown | (() => any) | Expr<any> |
|
|
1
|
+
import type { Expr } from './Expr.js';
|
|
2
|
+
import type { Select, SelectFirst } from './query/Select.js';
|
|
3
|
+
type SelectionBase = unknown | (() => any) | Expr<any> | Select<any> | SelectFirst<any>;
|
|
4
4
|
interface SelectionRecord extends Record<string, Selection> {
|
|
5
5
|
}
|
|
6
6
|
export type Selection = SelectionBase | SelectionRecord;
|
package/dist/define/Selection.js
CHANGED
package/dist/define/Sql.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { Query } from './Query';
|
|
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
4
|
function all<T>(strings: TemplateStringsArray, ...params: Array<unknown>): Query<T>;
|
package/dist/define/Sql.js
CHANGED
package/dist/define/Table.d.ts
CHANGED
|
@@ -1,11 +1,11 @@
|
|
|
1
|
-
import { ClearFunctionProto } from '../util/Callable';
|
|
2
|
-
import { Column, ColumnData, OptionalColumn, PrimaryColumn } from './Column';
|
|
3
|
-
import { EV, Expr } from './Expr';
|
|
4
|
-
import type { Fields } from './Fields';
|
|
5
|
-
import { Index, IndexData } from './Index';
|
|
6
|
-
import type { Selection } from './Selection';
|
|
7
|
-
import {
|
|
8
|
-
import { TableSelect } from './query/TableSelect';
|
|
1
|
+
import { ClearFunctionProto } from '../util/Callable.js';
|
|
2
|
+
import { Column, ColumnData, OptionalColumn, PrimaryColumn } from './Column.js';
|
|
3
|
+
import { EV, Expr } from './Expr.js';
|
|
4
|
+
import type { Fields } from './Fields.js';
|
|
5
|
+
import { Index, IndexData } from './Index.js';
|
|
6
|
+
import type { Selection } from './Selection.js';
|
|
7
|
+
import { SelectFirst } from './query/Select.js';
|
|
8
|
+
import { TableSelect } from './query/TableSelect.js';
|
|
9
9
|
interface TableDefinition {
|
|
10
10
|
}
|
|
11
11
|
export declare class TableData {
|
|
@@ -36,7 +36,7 @@ type RowOf<Definition> = {
|
|
|
36
36
|
[K in keyof Definition as Definition[K] extends Column<any> ? K : never]: Definition[K] extends Column<infer T> ? T : never;
|
|
37
37
|
};
|
|
38
38
|
type UpdateOf<Definition> = Partial<{
|
|
39
|
-
[K in keyof Definition as Definition[K] extends Column<any> ? K : never]: Definition[K] extends Column<infer T> ? EV<T> |
|
|
39
|
+
[K in keyof Definition as Definition[K] extends Column<any> ? K : never]: Definition[K] extends Column<infer T> ? EV<T> | SelectFirst<T> : never;
|
|
40
40
|
}>;
|
|
41
41
|
export declare namespace Table {
|
|
42
42
|
export const Data: unique symbol;
|
package/dist/define/Table.js
CHANGED
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
// src/define/Table.ts
|
|
2
1
|
import {
|
|
3
2
|
Column,
|
|
4
3
|
ColumnType
|
|
@@ -6,7 +5,7 @@ import {
|
|
|
6
5
|
import { BinOpType, Expr, ExprData } from "./Expr.js";
|
|
7
6
|
import { Target } from "./Target.js";
|
|
8
7
|
import { TableSelect } from "./query/TableSelect.js";
|
|
9
|
-
|
|
8
|
+
const {
|
|
10
9
|
assign,
|
|
11
10
|
keys,
|
|
12
11
|
entries,
|
|
@@ -16,11 +15,11 @@ var {
|
|
|
16
15
|
setPrototypeOf,
|
|
17
16
|
defineProperty
|
|
18
17
|
} = Object;
|
|
19
|
-
|
|
18
|
+
class TableData {
|
|
20
19
|
constructor(data) {
|
|
21
20
|
assign(this, data);
|
|
22
21
|
}
|
|
23
|
-
}
|
|
22
|
+
}
|
|
24
23
|
var Table;
|
|
25
24
|
((Table2) => {
|
|
26
25
|
Table2.Data = Symbol("Table.Data");
|
package/dist/define/Target.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import type { ExprData } from './Expr';
|
|
2
|
-
import type { QueryData } from './Query';
|
|
3
|
-
import type { TableData } from './Table';
|
|
1
|
+
import type { ExprData } from './Expr.js';
|
|
2
|
+
import type { QueryData } from './Query.js';
|
|
3
|
+
import type { TableData } from './Table.js';
|
|
4
4
|
export declare enum TargetType {
|
|
5
5
|
Expr = "Target.Expr",
|
|
6
6
|
CTE = "Target.CTE",
|
package/dist/define/Target.js
CHANGED
|
@@ -1,16 +1,16 @@
|
|
|
1
|
-
import { ClearFunctionProto } from '../util/Callable';
|
|
2
|
-
import { Column } from './Column';
|
|
3
|
-
import { EV, Expr } from './Expr';
|
|
4
|
-
import { Fields } from './Fields';
|
|
5
|
-
import { Selection } from './Selection';
|
|
6
|
-
import { Table } from './Table';
|
|
7
|
-
import { Target } from './Target';
|
|
8
|
-
import {
|
|
1
|
+
import { ClearFunctionProto } from '../util/Callable.js';
|
|
2
|
+
import { Column } from './Column.js';
|
|
3
|
+
import { EV, Expr } from './Expr.js';
|
|
4
|
+
import { Fields } from './Fields.js';
|
|
5
|
+
import { Selection } from './Selection.js';
|
|
6
|
+
import { Table } from './Table.js';
|
|
7
|
+
import { Target } from './Target.js';
|
|
8
|
+
import { Select } from './query/Select.js';
|
|
9
9
|
export interface VirtualTableInstance<Definition> extends ClearFunctionProto {
|
|
10
10
|
(conditions: {
|
|
11
11
|
[K in keyof Definition]?: Definition[K] extends Expr<infer V> ? EV<V> : never;
|
|
12
|
-
}):
|
|
13
|
-
(...conditions: Array<EV<boolean>>):
|
|
12
|
+
}): Select<Table.Select<Definition>>;
|
|
13
|
+
(...conditions: Array<EV<boolean>>): Select<Table.Select<Definition>>;
|
|
14
14
|
}
|
|
15
15
|
export declare class VirtualTableInstance<Definition> {
|
|
16
16
|
[Selection.TableType](): Table.Select<Definition>;
|
|
@@ -19,7 +19,7 @@ export declare class VirtualTableInstance<Definition> {
|
|
|
19
19
|
export interface VirtualTableData {
|
|
20
20
|
name: string;
|
|
21
21
|
target: Target;
|
|
22
|
-
select: (conditions: Array<EV<boolean>>) =>
|
|
22
|
+
select: (conditions: Array<EV<boolean>>) => Select<any>;
|
|
23
23
|
}
|
|
24
24
|
export type VirtualTable<Definition> = Definition & VirtualTableInstance<Definition>;
|
|
25
25
|
export declare namespace VirtualTable {
|
|
@@ -1,6 +1,5 @@
|
|
|
1
|
-
// src/define/query/Batch.ts
|
|
2
1
|
import { Query, QueryData } from "../Query.js";
|
|
3
|
-
|
|
2
|
+
class Batch extends Query {
|
|
4
3
|
constructor(queries) {
|
|
5
4
|
super(new QueryData.Batch({ queries }));
|
|
6
5
|
this.queries = queries;
|
|
@@ -12,7 +11,7 @@ var Batch = class extends Query {
|
|
|
12
11
|
})
|
|
13
12
|
);
|
|
14
13
|
}
|
|
15
|
-
}
|
|
14
|
+
}
|
|
16
15
|
export {
|
|
17
16
|
Batch
|
|
18
17
|
};
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { Query } from '../Query';
|
|
2
|
-
import { TableData } from '../Table';
|
|
1
|
+
import { Query } from '../Query.js';
|
|
2
|
+
import { TableData } from '../Table.js';
|
|
3
3
|
export declare class CreateTable extends Query<void> {
|
|
4
4
|
protected table: TableData;
|
|
5
5
|
constructor(table: TableData);
|
|
@@ -1,12 +1,11 @@
|
|
|
1
|
-
// src/define/query/CreateTable.ts
|
|
2
1
|
import { Query } from "../Query.js";
|
|
3
2
|
import { Schema } from "../Schema.js";
|
|
4
|
-
|
|
3
|
+
class CreateTable extends Query {
|
|
5
4
|
constructor(table) {
|
|
6
5
|
super(Schema.create(table));
|
|
7
6
|
this.table = table;
|
|
8
7
|
}
|
|
9
|
-
}
|
|
8
|
+
}
|
|
10
9
|
export {
|
|
11
10
|
CreateTable
|
|
12
11
|
};
|
|
@@ -1,6 +1,5 @@
|
|
|
1
|
-
// src/define/query/Delete.ts
|
|
2
1
|
import { Query } from "../Query.js";
|
|
3
|
-
|
|
2
|
+
class Delete extends Query {
|
|
4
3
|
constructor(query) {
|
|
5
4
|
super(query);
|
|
6
5
|
}
|
|
@@ -13,7 +12,7 @@ var Delete = class extends Query {
|
|
|
13
12
|
skip(offset) {
|
|
14
13
|
return new Delete(this[Query.Data].with({ offset }));
|
|
15
14
|
}
|
|
16
|
-
}
|
|
15
|
+
}
|
|
17
16
|
export {
|
|
18
17
|
Delete
|
|
19
18
|
};
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import { Query, QueryData } from '../Query';
|
|
2
|
-
import { Selection } from '../Selection';
|
|
3
|
-
import { Table, TableData } from '../Table';
|
|
4
|
-
import {
|
|
1
|
+
import { Query, QueryData } from '../Query.js';
|
|
2
|
+
import { Selection } from '../Selection.js';
|
|
3
|
+
import { Table, TableData } from '../Table.js';
|
|
4
|
+
import { Select } from './Select.js';
|
|
5
5
|
export declare class InsertValuesReturning<T> extends Query<T> {
|
|
6
6
|
}
|
|
7
7
|
export declare class Inserted extends Query<{
|
|
@@ -14,6 +14,6 @@ export declare class Inserted extends Query<{
|
|
|
14
14
|
export declare class Insert<Definition> {
|
|
15
15
|
protected into: TableData;
|
|
16
16
|
constructor(into: TableData);
|
|
17
|
-
selection(query:
|
|
17
|
+
selection(query: Select<Table.Select<Definition>>): Inserted;
|
|
18
18
|
values(...data: Array<Table.Insert<Definition>>): Inserted;
|
|
19
19
|
}
|
|
@@ -1,9 +1,8 @@
|
|
|
1
|
-
// src/define/query/Insert.ts
|
|
2
1
|
import { ExprData } from "../Expr.js";
|
|
3
2
|
import { Query, QueryData } from "../Query.js";
|
|
4
|
-
|
|
5
|
-
}
|
|
6
|
-
|
|
3
|
+
class InsertValuesReturning extends Query {
|
|
4
|
+
}
|
|
5
|
+
class Inserted extends Query {
|
|
7
6
|
constructor(query) {
|
|
8
7
|
super(query);
|
|
9
8
|
}
|
|
@@ -15,8 +14,8 @@ var Inserted = class extends Query {
|
|
|
15
14
|
})
|
|
16
15
|
);
|
|
17
16
|
}
|
|
18
|
-
}
|
|
19
|
-
|
|
17
|
+
}
|
|
18
|
+
class Insert {
|
|
20
19
|
constructor(into) {
|
|
21
20
|
this.into = into;
|
|
22
21
|
}
|
|
@@ -28,7 +27,7 @@ var Insert = class {
|
|
|
28
27
|
values(...data) {
|
|
29
28
|
return new Inserted(new QueryData.Insert({ into: this.into, data }));
|
|
30
29
|
}
|
|
31
|
-
}
|
|
30
|
+
}
|
|
32
31
|
export {
|
|
33
32
|
Insert,
|
|
34
33
|
InsertValuesReturning,
|