rado 0.1.44 → 0.1.46
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/lib/Column.d.ts +1 -1
- package/dist/lib/Column.js +6 -2
- package/dist/lib/Formatter.d.ts +1 -1
- package/dist/lib/Formatter.js +2 -2
- package/package.json +1 -1
package/dist/lib/Column.d.ts
CHANGED
|
@@ -26,7 +26,7 @@ export declare class Column<T> {
|
|
|
26
26
|
name(name: string): Column<T>;
|
|
27
27
|
nullable(): Column<T | null>;
|
|
28
28
|
autoIncrement(): Column<Column.IsOptional<T>>;
|
|
29
|
-
primaryKey<K extends string>(): Column<Column.IsPrimary<T, K>>;
|
|
29
|
+
primaryKey<K extends string>(create?: () => EV<T>): Column<Column.IsPrimary<T, K>>;
|
|
30
30
|
references<X extends T>(column: Expr<X> | (() => Expr<X>)): Column<X>;
|
|
31
31
|
unique(): Column<T>;
|
|
32
32
|
defaultValue(create: () => EV<T>): Column<Column.IsOptional<T>>;
|
package/dist/lib/Column.js
CHANGED
|
@@ -21,8 +21,12 @@ var Column = class {
|
|
|
21
21
|
autoIncrement() {
|
|
22
22
|
return new Column({ ...this.data, autoIncrement: true });
|
|
23
23
|
}
|
|
24
|
-
primaryKey() {
|
|
25
|
-
return new Column({
|
|
24
|
+
primaryKey(create) {
|
|
25
|
+
return new Column({
|
|
26
|
+
...this.data,
|
|
27
|
+
primaryKey: true,
|
|
28
|
+
defaultValue: create ? () => ExprData.create(create()) : this.data.defaultValue
|
|
29
|
+
});
|
|
26
30
|
}
|
|
27
31
|
references(column2) {
|
|
28
32
|
return new Column({
|
package/dist/lib/Formatter.d.ts
CHANGED
|
@@ -28,7 +28,7 @@ export declare abstract class Formatter implements Sanitizer {
|
|
|
28
28
|
abstract escapeIdentifier(ident: string): string;
|
|
29
29
|
abstract formatParamValue(paramValue: any): any;
|
|
30
30
|
abstract formatAccess(ctx: FormatContext, mkSubject: () => void, field: string): Statement;
|
|
31
|
-
compile<T>(query: Query<T>): Statement;
|
|
31
|
+
compile<T>(query: Query<T>, options?: Partial<FormatContext>): Statement;
|
|
32
32
|
format<T>(ctx: FormatContext, query: Query<T>): Statement;
|
|
33
33
|
formatSelect(ctx: FormatContext, query: Query.Select): Statement;
|
|
34
34
|
formatInsert(ctx: FormatContext, query: Query.Insert): Statement;
|
package/dist/lib/Formatter.js
CHANGED
|
@@ -39,9 +39,9 @@ function formatAsResultObject(stmt, mkSubject) {
|
|
|
39
39
|
var Formatter = class {
|
|
40
40
|
constructor() {
|
|
41
41
|
}
|
|
42
|
-
compile(query) {
|
|
42
|
+
compile(query, options) {
|
|
43
43
|
const stmt = new Statement(this);
|
|
44
|
-
const result = this.format({ stmt, topLevel: true }, query);
|
|
44
|
+
const result = this.format({ stmt, topLevel: true, ...options }, query);
|
|
45
45
|
return result;
|
|
46
46
|
}
|
|
47
47
|
format(ctx, query) {
|