pqb 0.4.8 → 0.5.0
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/index.d.ts +2 -1
- package/dist/index.esm.js +3 -5
- package/dist/index.esm.js.map +1 -1
- package/dist/index.js +3 -5
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
- package/src/columnSchema/columnType.ts +3 -2
- package/src/columnSchema/dateTime.ts +3 -3
package/dist/index.d.ts
CHANGED
|
@@ -2266,6 +2266,7 @@ declare type ColumnData = {
|
|
|
2266
2266
|
compression?: string;
|
|
2267
2267
|
foreignKey?: ForeignKey<string, string[]>;
|
|
2268
2268
|
modifyQuery?: (q: Query) => void;
|
|
2269
|
+
as?: ColumnType;
|
|
2269
2270
|
};
|
|
2270
2271
|
declare type ForeignKeyMatch = 'FULL' | 'PARTIAL' | 'SIMPLE';
|
|
2271
2272
|
declare type ForeignKeyAction = 'NO ACTION' | 'RESTRICT' | 'CASCADE' | 'SET NULL' | 'SET DEFAULT';
|
|
@@ -2347,7 +2348,7 @@ declare abstract class ColumnType<Type = unknown, Ops extends Operators = Operat
|
|
|
2347
2348
|
parse<T extends ColumnType, Output>(this: T, fn: (input: T['type']) => Output): Omit<T, 'type'> & {
|
|
2348
2349
|
type: Output;
|
|
2349
2350
|
};
|
|
2350
|
-
as<T extends ColumnType, C extends ColumnType<T['type'], Operators, T['inputType']>>(this: T,
|
|
2351
|
+
as<T extends ColumnType, C extends ColumnType<T['type'], Operators, T['inputType']>>(this: T, column: C): C;
|
|
2351
2352
|
toSQL(): string;
|
|
2352
2353
|
default<T extends ColumnType>(this: T, value: T['type'] | RawExpression): T & {
|
|
2353
2354
|
hasDefault: true;
|
package/dist/index.esm.js
CHANGED
|
@@ -66,8 +66,8 @@ class ColumnType {
|
|
|
66
66
|
this.parseItem = fn;
|
|
67
67
|
return this;
|
|
68
68
|
}
|
|
69
|
-
as(
|
|
70
|
-
return this;
|
|
69
|
+
as(column) {
|
|
70
|
+
return addColumnData(this, "as", column);
|
|
71
71
|
}
|
|
72
72
|
toSQL() {
|
|
73
73
|
return this.dataType;
|
|
@@ -1953,9 +1953,7 @@ class DateBaseColumn extends ColumnType {
|
|
|
1953
1953
|
this.operators = Operators.date;
|
|
1954
1954
|
}
|
|
1955
1955
|
asNumber() {
|
|
1956
|
-
return this.encode((input) => new Date(input)).parse(
|
|
1957
|
-
Date.parse
|
|
1958
|
-
);
|
|
1956
|
+
return this.encode((input) => new Date(input)).parse(Date.parse).as(new IntegerColumn());
|
|
1959
1957
|
}
|
|
1960
1958
|
asDate() {
|
|
1961
1959
|
return this.parse((input) => new Date(input));
|