rado 0.2.26 → 0.2.27
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/Ops.d.ts
CHANGED
|
@@ -7,6 +7,7 @@ import { SelectMultiple } from './query/Select';
|
|
|
7
7
|
import { RecursiveUnion } from './query/Union';
|
|
8
8
|
import { Update } from './query/Update';
|
|
9
9
|
export declare function withRecursive<Row>(initialSelect: SelectMultiple<Row>): RecursiveUnion<Row>;
|
|
10
|
+
export declare function alias<T extends Table<{}>>(table: T): Record<string, T>;
|
|
10
11
|
export declare function select<X extends Selection>(selection: X): SelectMultiple<Selection.Infer<X>>;
|
|
11
12
|
export declare function from<Row>(source: Table<Row> | SelectMultiple<Row>): SelectMultiple<Row>;
|
|
12
13
|
export declare function update<Row>(table: Table<Row>): Update<Row>;
|
package/dist/define/Ops.js
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
import { ExprData } from "./Expr.js";
|
|
3
3
|
import { Query, QueryData } from "./Query.js";
|
|
4
4
|
import { Schema } from "./Schema.js";
|
|
5
|
-
import { Table } from "./Table.js";
|
|
5
|
+
import { Table, createTable } from "./Table.js";
|
|
6
6
|
import { Target } from "./Target.js";
|
|
7
7
|
import { Batch } from "./query/Batch.js";
|
|
8
8
|
import { Delete } from "./query/Delete.js";
|
|
@@ -13,6 +13,13 @@ import { Update } from "./query/Update.js";
|
|
|
13
13
|
function withRecursive(initialSelect) {
|
|
14
14
|
return new RecursiveUnion(initialSelect[Query.Data]);
|
|
15
15
|
}
|
|
16
|
+
function alias(table) {
|
|
17
|
+
return new Proxy(/* @__PURE__ */ Object.create(null), {
|
|
18
|
+
get(_, alias2) {
|
|
19
|
+
return createTable({ ...table[Table.Data], alias: alias2 });
|
|
20
|
+
}
|
|
21
|
+
});
|
|
22
|
+
}
|
|
16
23
|
function select(selection) {
|
|
17
24
|
return new SelectMultiple(
|
|
18
25
|
new QueryData.Select({
|
|
@@ -44,6 +51,7 @@ function create(...tables) {
|
|
|
44
51
|
);
|
|
45
52
|
}
|
|
46
53
|
export {
|
|
54
|
+
alias,
|
|
47
55
|
create,
|
|
48
56
|
deleteFrom,
|
|
49
57
|
from,
|
|
@@ -4,14 +4,13 @@ import { Query, QueryData } from '../Query';
|
|
|
4
4
|
import { Selection } from '../Selection';
|
|
5
5
|
import { Table } from '../Table';
|
|
6
6
|
import { VirtualTable } from '../VirtualTable';
|
|
7
|
-
import { TableSelect } from './TableSelect';
|
|
8
7
|
import { Union } from './Union';
|
|
9
8
|
export declare class SelectMultiple<Row> extends Union<Row> {
|
|
10
9
|
[Query.Data]: QueryData.Select;
|
|
11
10
|
constructor(query: QueryData.Select);
|
|
12
11
|
from(table: Table<any> | VirtualTable<any>): SelectMultiple<Row>;
|
|
13
|
-
leftJoin<C>(that: Table<C> |
|
|
14
|
-
innerJoin<C>(that: Table<C> |
|
|
12
|
+
leftJoin<C>(that: Table<C> | SelectMultiple<C>, ...on: Array<EV<boolean>>): SelectMultiple<Row>;
|
|
13
|
+
innerJoin<C>(that: Table<C> | SelectMultiple<C>, ...on: Array<EV<boolean>>): SelectMultiple<Row>;
|
|
15
14
|
select<X extends Selection>(selection: X): SelectMultiple<Selection.Infer<X>>;
|
|
16
15
|
count(): SelectSingle<number>;
|
|
17
16
|
orderBy(...orderBy: Array<Expr<any> | OrderBy>): SelectMultiple<Row>;
|
|
@@ -27,8 +26,8 @@ export declare class SelectSingle<Row> extends Query<Row> {
|
|
|
27
26
|
[Query.Data]: QueryData.Select;
|
|
28
27
|
constructor(query: QueryData.Select);
|
|
29
28
|
from(table: Table<any>): SelectMultiple<Row>;
|
|
30
|
-
leftJoin<C>(that: Table<C> |
|
|
31
|
-
innerJoin<C>(that: Table<C> |
|
|
29
|
+
leftJoin<C>(that: Table<C> | SelectMultiple<C>, ...on: Array<EV<boolean>>): SelectSingle<Row>;
|
|
30
|
+
innerJoin<C>(that: Table<C> | SelectMultiple<C>, ...on: Array<EV<boolean>>): SelectSingle<Row>;
|
|
32
31
|
select<X extends Selection>(selection: X): SelectSingle<Selection.Infer<X>>;
|
|
33
32
|
orderBy(...orderBy: Array<OrderBy>): SelectSingle<Row>;
|
|
34
33
|
groupBy(...groupBy: Array<Expr<any>>): SelectSingle<Row>;
|