drizzle-orm 0.39.3 → 0.40.0-262a7b0
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/column-builder.cjs.map +1 -1
- package/column-builder.d.cts +6 -5
- package/column-builder.d.ts +6 -5
- package/column-builder.js.map +1 -1
- package/gel/driver.cjs +97 -0
- package/gel/driver.cjs.map +1 -0
- package/gel/driver.d.cts +38 -0
- package/gel/driver.d.ts +38 -0
- package/gel/driver.js +74 -0
- package/gel/driver.js.map +1 -0
- package/gel/index.cjs +25 -0
- package/gel/index.cjs.map +1 -0
- package/gel/index.d.cts +2 -0
- package/gel/index.d.ts +2 -0
- package/gel/index.js +3 -0
- package/gel/index.js.map +1 -0
- package/gel/migrator.cjs +5 -0
- package/gel/migrator.cjs.map +1 -0
- package/gel/migrator.d.cts +1 -0
- package/gel/migrator.d.ts +1 -0
- package/gel/migrator.js +4 -0
- package/gel/migrator.js.map +1 -0
- package/gel/session.cjs +139 -0
- package/gel/session.cjs.map +1 -0
- package/gel/session.d.cts +47 -0
- package/gel/session.d.ts +47 -0
- package/gel/session.js +113 -0
- package/gel/session.js.map +1 -0
- package/gel-core/alias.cjs +32 -0
- package/gel-core/alias.cjs.map +1 -0
- package/gel-core/alias.d.cts +4 -0
- package/gel-core/alias.d.ts +4 -0
- package/gel-core/alias.js +8 -0
- package/gel-core/alias.js.map +1 -0
- package/gel-core/checks.cjs +58 -0
- package/gel-core/checks.cjs.map +1 -0
- package/gel-core/checks.d.cts +18 -0
- package/gel-core/checks.d.ts +18 -0
- package/gel-core/checks.js +32 -0
- package/gel-core/checks.js.map +1 -0
- package/gel-core/columns/all.cjs +72 -0
- package/gel-core/columns/all.cjs.map +1 -0
- package/gel-core/columns/all.d.cts +43 -0
- package/gel-core/columns/all.d.ts +43 -0
- package/gel-core/columns/all.js +48 -0
- package/gel-core/columns/all.js.map +1 -0
- package/gel-core/columns/bigint.cjs +54 -0
- package/gel-core/columns/bigint.cjs.map +1 -0
- package/gel-core/columns/bigint.d.cts +23 -0
- package/gel-core/columns/bigint.d.ts +23 -0
- package/gel-core/columns/bigint.js +28 -0
- package/gel-core/columns/bigint.js.map +1 -0
- package/gel-core/columns/bigintT.cjs +60 -0
- package/gel-core/columns/bigintT.cjs.map +1 -0
- package/gel-core/columns/bigintT.d.cts +24 -0
- package/gel-core/columns/bigintT.d.ts +24 -0
- package/gel-core/columns/bigintT.js +34 -0
- package/gel-core/columns/bigintT.js.map +1 -0
- package/gel-core/columns/boolean.cjs +53 -0
- package/gel-core/columns/boolean.cjs.map +1 -0
- package/gel-core/columns/boolean.d.cts +22 -0
- package/gel-core/columns/boolean.d.ts +22 -0
- package/gel-core/columns/boolean.js +27 -0
- package/gel-core/columns/boolean.js.map +1 -0
- package/gel-core/columns/bytes.cjs +56 -0
- package/gel-core/columns/bytes.cjs.map +1 -0
- package/gel-core/columns/bytes.d.cts +22 -0
- package/gel-core/columns/bytes.d.ts +22 -0
- package/gel-core/columns/bytes.js +30 -0
- package/gel-core/columns/bytes.js.map +1 -0
- package/gel-core/columns/common.cjs +213 -0
- package/gel-core/columns/common.cjs.map +1 -0
- package/gel-core/columns/common.d.cts +147 -0
- package/gel-core/columns/common.d.ts +147 -0
- package/gel-core/columns/common.js +184 -0
- package/gel-core/columns/common.js.map +1 -0
- package/gel-core/columns/custom.cjs +77 -0
- package/gel-core/columns/custom.cjs.map +1 -0
- package/gel-core/columns/custom.d.cts +155 -0
- package/gel-core/columns/custom.d.ts +155 -0
- package/gel-core/columns/custom.js +51 -0
- package/gel-core/columns/custom.js.map +1 -0
- package/gel-core/columns/date-duration.cjs +56 -0
- package/gel-core/columns/date-duration.cjs.map +1 -0
- package/gel-core/columns/date-duration.d.cts +23 -0
- package/gel-core/columns/date-duration.d.ts +23 -0
- package/gel-core/columns/date-duration.js +30 -0
- package/gel-core/columns/date-duration.js.map +1 -0
- package/gel-core/columns/date.common.cjs +37 -0
- package/gel-core/columns/date.common.cjs.map +1 -0
- package/gel-core/columns/date.common.d.cts +7 -0
- package/gel-core/columns/date.common.d.ts +7 -0
- package/gel-core/columns/date.common.js +13 -0
- package/gel-core/columns/date.common.js.map +1 -0
- package/gel-core/columns/decimal.cjs +56 -0
- package/gel-core/columns/decimal.cjs.map +1 -0
- package/gel-core/columns/decimal.d.cts +26 -0
- package/gel-core/columns/decimal.d.ts +26 -0
- package/gel-core/columns/decimal.js +30 -0
- package/gel-core/columns/decimal.js.map +1 -0
- package/gel-core/columns/double-precision.cjs +62 -0
- package/gel-core/columns/double-precision.cjs.map +1 -0
- package/gel-core/columns/double-precision.d.cts +23 -0
- package/gel-core/columns/double-precision.d.ts +23 -0
- package/gel-core/columns/double-precision.js +36 -0
- package/gel-core/columns/double-precision.js.map +1 -0
- package/gel-core/columns/duration.cjs +53 -0
- package/gel-core/columns/duration.cjs.map +1 -0
- package/gel-core/columns/duration.d.cts +23 -0
- package/gel-core/columns/duration.d.ts +23 -0
- package/gel-core/columns/duration.js +27 -0
- package/gel-core/columns/duration.js.map +1 -0
- package/gel-core/columns/index.cjs +65 -0
- package/gel-core/columns/index.cjs.map +1 -0
- package/gel-core/columns/index.d.cts +22 -0
- package/gel-core/columns/index.d.ts +22 -0
- package/gel-core/columns/index.js +23 -0
- package/gel-core/columns/index.js.map +1 -0
- package/gel-core/columns/int.common.cjs +67 -0
- package/gel-core/columns/int.common.cjs.map +1 -0
- package/gel-core/columns/int.common.d.cts +15 -0
- package/gel-core/columns/int.common.d.ts +15 -0
- package/gel-core/columns/int.common.js +43 -0
- package/gel-core/columns/int.common.js.map +1 -0
- package/gel-core/columns/integer.cjs +54 -0
- package/gel-core/columns/integer.cjs.map +1 -0
- package/gel-core/columns/integer.d.cts +23 -0
- package/gel-core/columns/integer.d.ts +23 -0
- package/gel-core/columns/integer.js +28 -0
- package/gel-core/columns/integer.js.map +1 -0
- package/gel-core/columns/json.cjs +56 -0
- package/gel-core/columns/json.cjs.map +1 -0
- package/gel-core/columns/json.d.cts +26 -0
- package/gel-core/columns/json.d.ts +26 -0
- package/gel-core/columns/json.js +30 -0
- package/gel-core/columns/json.js.map +1 -0
- package/gel-core/columns/localdate.cjs +57 -0
- package/gel-core/columns/localdate.cjs.map +1 -0
- package/gel-core/columns/localdate.d.cts +24 -0
- package/gel-core/columns/localdate.d.ts +24 -0
- package/gel-core/columns/localdate.js +31 -0
- package/gel-core/columns/localdate.js.map +1 -0
- package/gel-core/columns/localtime.cjs +57 -0
- package/gel-core/columns/localtime.cjs.map +1 -0
- package/gel-core/columns/localtime.d.cts +24 -0
- package/gel-core/columns/localtime.d.ts +24 -0
- package/gel-core/columns/localtime.js +31 -0
- package/gel-core/columns/localtime.js.map +1 -0
- package/gel-core/columns/real.cjs +57 -0
- package/gel-core/columns/real.cjs.map +1 -0
- package/gel-core/columns/real.d.cts +28 -0
- package/gel-core/columns/real.d.ts +28 -0
- package/gel-core/columns/real.js +31 -0
- package/gel-core/columns/real.js.map +1 -0
- package/gel-core/columns/relative-duration.cjs +56 -0
- package/gel-core/columns/relative-duration.cjs.map +1 -0
- package/gel-core/columns/relative-duration.d.cts +23 -0
- package/gel-core/columns/relative-duration.d.ts +23 -0
- package/gel-core/columns/relative-duration.js +30 -0
- package/gel-core/columns/relative-duration.js.map +1 -0
- package/gel-core/columns/smallint.cjs +54 -0
- package/gel-core/columns/smallint.cjs.map +1 -0
- package/gel-core/columns/smallint.d.cts +23 -0
- package/gel-core/columns/smallint.d.ts +23 -0
- package/gel-core/columns/smallint.js +28 -0
- package/gel-core/columns/smallint.js.map +1 -0
- package/gel-core/columns/text.cjs +54 -0
- package/gel-core/columns/text.cjs.map +1 -0
- package/gel-core/columns/text.d.cts +26 -0
- package/gel-core/columns/text.d.ts +26 -0
- package/gel-core/columns/text.js +28 -0
- package/gel-core/columns/text.js.map +1 -0
- package/gel-core/columns/timestamp.cjs +60 -0
- package/gel-core/columns/timestamp.cjs.map +1 -0
- package/gel-core/columns/timestamp.d.cts +28 -0
- package/gel-core/columns/timestamp.d.ts +28 -0
- package/gel-core/columns/timestamp.js +34 -0
- package/gel-core/columns/timestamp.js.map +1 -0
- package/gel-core/columns/timestamptz.cjs +60 -0
- package/gel-core/columns/timestamptz.cjs.map +1 -0
- package/gel-core/columns/timestamptz.d.cts +27 -0
- package/gel-core/columns/timestamptz.d.ts +27 -0
- package/gel-core/columns/timestamptz.js +34 -0
- package/gel-core/columns/timestamptz.js.map +1 -0
- package/gel-core/columns/uuid.cjs +53 -0
- package/gel-core/columns/uuid.cjs.map +1 -0
- package/gel-core/columns/uuid.d.cts +22 -0
- package/gel-core/columns/uuid.d.ts +22 -0
- package/gel-core/columns/uuid.js +27 -0
- package/gel-core/columns/uuid.js.map +1 -0
- package/gel-core/db.cjs +338 -0
- package/gel-core/db.cjs.map +1 -0
- package/gel-core/db.d.cts +281 -0
- package/gel-core/db.d.ts +281 -0
- package/gel-core/db.js +319 -0
- package/gel-core/db.js.map +1 -0
- package/gel-core/dialect.cjs +1142 -0
- package/gel-core/dialect.cjs.map +1 -0
- package/gel-core/dialect.d.cts +62 -0
- package/gel-core/dialect.d.ts +62 -0
- package/gel-core/dialect.js +1128 -0
- package/gel-core/dialect.js.map +1 -0
- package/gel-core/expressions.cjs +49 -0
- package/gel-core/expressions.cjs.map +1 -0
- package/gel-core/expressions.d.cts +8 -0
- package/gel-core/expressions.d.ts +8 -0
- package/gel-core/expressions.js +22 -0
- package/gel-core/expressions.js.map +1 -0
- package/gel-core/foreign-keys.cjs +100 -0
- package/gel-core/foreign-keys.cjs.map +1 -0
- package/gel-core/foreign-keys.d.cts +48 -0
- package/gel-core/foreign-keys.d.ts +48 -0
- package/gel-core/foreign-keys.js +74 -0
- package/gel-core/foreign-keys.js.map +1 -0
- package/gel-core/index.cjs +61 -0
- package/gel-core/index.cjs.map +1 -0
- package/gel-core/index.d.cts +20 -0
- package/gel-core/index.d.ts +20 -0
- package/gel-core/index.js +21 -0
- package/gel-core/index.js.map +1 -0
- package/gel-core/indexes.cjs +149 -0
- package/gel-core/indexes.cjs.map +1 -0
- package/gel-core/indexes.d.cts +79 -0
- package/gel-core/indexes.d.ts +79 -0
- package/gel-core/indexes.js +121 -0
- package/gel-core/indexes.js.map +1 -0
- package/gel-core/policies.cjs +58 -0
- package/gel-core/policies.cjs.map +1 -0
- package/gel-core/policies.d.cts +24 -0
- package/gel-core/policies.d.ts +24 -0
- package/gel-core/policies.js +33 -0
- package/gel-core/policies.js.map +1 -0
- package/gel-core/primary-keys.cjs +68 -0
- package/gel-core/primary-keys.cjs.map +1 -0
- package/gel-core/primary-keys.d.cts +30 -0
- package/gel-core/primary-keys.d.ts +30 -0
- package/gel-core/primary-keys.js +42 -0
- package/gel-core/primary-keys.js.map +1 -0
- package/gel-core/query-builders/count.cjs +73 -0
- package/gel-core/query-builders/count.cjs.map +1 -0
- package/gel-core/query-builders/count.d.cts +25 -0
- package/gel-core/query-builders/count.d.ts +25 -0
- package/gel-core/query-builders/count.js +49 -0
- package/gel-core/query-builders/count.js.map +1 -0
- package/gel-core/query-builders/delete.cjs +105 -0
- package/gel-core/query-builders/delete.cjs.map +1 -0
- package/gel-core/query-builders/delete.d.cts +99 -0
- package/gel-core/query-builders/delete.d.ts +99 -0
- package/gel-core/query-builders/delete.js +81 -0
- package/gel-core/query-builders/delete.js.map +1 -0
- package/gel-core/query-builders/index.cjs +35 -0
- package/gel-core/query-builders/index.cjs.map +1 -0
- package/gel-core/query-builders/index.d.cts +7 -0
- package/gel-core/query-builders/index.d.ts +7 -0
- package/gel-core/query-builders/index.js +8 -0
- package/gel-core/query-builders/index.js.map +1 -0
- package/gel-core/query-builders/insert.cjs +218 -0
- package/gel-core/query-builders/insert.cjs.map +1 -0
- package/gel-core/query-builders/insert.d.cts +116 -0
- package/gel-core/query-builders/insert.d.ts +116 -0
- package/gel-core/query-builders/insert.js +193 -0
- package/gel-core/query-builders/insert.js.map +1 -0
- package/gel-core/query-builders/query-builder.cjs +114 -0
- package/gel-core/query-builders/query-builder.cjs.map +1 -0
- package/gel-core/query-builders/query-builder.d.cts +40 -0
- package/gel-core/query-builders/query-builder.d.ts +40 -0
- package/gel-core/query-builders/query-builder.js +90 -0
- package/gel-core/query-builders/query-builder.js.map +1 -0
- package/gel-core/query-builders/query.cjs +139 -0
- package/gel-core/query-builders/query.cjs.map +1 -0
- package/gel-core/query-builders/query.d.cts +46 -0
- package/gel-core/query-builders/query.d.ts +46 -0
- package/gel-core/query-builders/query.js +116 -0
- package/gel-core/query-builders/query.js.map +1 -0
- package/gel-core/query-builders/raw.cjs +57 -0
- package/gel-core/query-builders/raw.cjs.map +1 -0
- package/gel-core/query-builders/raw.d.cts +22 -0
- package/gel-core/query-builders/raw.d.ts +22 -0
- package/gel-core/query-builders/raw.js +33 -0
- package/gel-core/query-builders/raw.js.map +1 -0
- package/gel-core/query-builders/refresh-materialized-view.cjs +77 -0
- package/gel-core/query-builders/refresh-materialized-view.cjs.map +1 -0
- package/gel-core/query-builders/refresh-materialized-view.d.cts +27 -0
- package/gel-core/query-builders/refresh-materialized-view.d.ts +27 -0
- package/gel-core/query-builders/refresh-materialized-view.js +53 -0
- package/gel-core/query-builders/refresh-materialized-view.js.map +1 -0
- package/gel-core/query-builders/select.cjs +775 -0
- package/gel-core/query-builders/select.cjs.map +1 -0
- package/gel-core/query-builders/select.d.cts +721 -0
- package/gel-core/query-builders/select.d.ts +721 -0
- package/gel-core/query-builders/select.js +748 -0
- package/gel-core/query-builders/select.js.map +1 -0
- package/gel-core/query-builders/select.types.cjs +17 -0
- package/gel-core/query-builders/select.types.cjs.map +1 -0
- package/gel-core/query-builders/select.types.d.cts +138 -0
- package/gel-core/query-builders/select.types.d.ts +138 -0
- package/gel-core/query-builders/select.types.js +1 -0
- package/gel-core/query-builders/select.types.js.map +1 -0
- package/gel-core/query-builders/update.cjs +226 -0
- package/gel-core/query-builders/update.cjs.map +1 -0
- package/gel-core/query-builders/update.d.cts +166 -0
- package/gel-core/query-builders/update.d.ts +166 -0
- package/gel-core/query-builders/update.js +205 -0
- package/gel-core/query-builders/update.js.map +1 -0
- package/gel-core/roles.cjs +57 -0
- package/gel-core/roles.cjs.map +1 -0
- package/gel-core/roles.d.cts +13 -0
- package/gel-core/roles.d.ts +13 -0
- package/gel-core/roles.js +32 -0
- package/gel-core/roles.js.map +1 -0
- package/gel-core/schema.cjs +74 -0
- package/gel-core/schema.cjs.map +1 -0
- package/gel-core/schema.d.cts +15 -0
- package/gel-core/schema.d.ts +15 -0
- package/gel-core/schema.js +48 -0
- package/gel-core/schema.js.map +1 -0
- package/gel-core/sequence.cjs +52 -0
- package/gel-core/sequence.cjs.map +1 -0
- package/gel-core/sequence.d.cts +18 -0
- package/gel-core/sequence.d.ts +18 -0
- package/gel-core/sequence.js +25 -0
- package/gel-core/sequence.js.map +1 -0
- package/gel-core/session.cjs +94 -0
- package/gel-core/session.cjs.map +1 -0
- package/gel-core/session.d.cts +56 -0
- package/gel-core/session.d.ts +56 -0
- package/gel-core/session.js +68 -0
- package/gel-core/session.js.map +1 -0
- package/gel-core/subquery.cjs +17 -0
- package/gel-core/subquery.cjs.map +1 -0
- package/gel-core/subquery.d.cts +5 -0
- package/gel-core/subquery.d.ts +5 -0
- package/gel-core/subquery.js +1 -0
- package/gel-core/subquery.js.map +1 -0
- package/gel-core/table.cjs +100 -0
- package/gel-core/table.cjs.map +1 -0
- package/gel-core/table.d.cts +95 -0
- package/gel-core/table.d.ts +95 -0
- package/gel-core/table.js +71 -0
- package/gel-core/table.js.map +1 -0
- package/gel-core/unique-constraint.cjs +89 -0
- package/gel-core/unique-constraint.cjs.map +1 -0
- package/gel-core/unique-constraint.d.cts +25 -0
- package/gel-core/unique-constraint.d.ts +25 -0
- package/gel-core/unique-constraint.js +61 -0
- package/gel-core/unique-constraint.js.map +1 -0
- package/gel-core/utils.cjs +100 -0
- package/gel-core/utils.cjs.map +1 -0
- package/gel-core/utils.d.cts +51 -0
- package/gel-core/utils.d.ts +51 -0
- package/gel-core/utils.js +74 -0
- package/gel-core/utils.js.map +1 -0
- package/gel-core/view-base.cjs +33 -0
- package/gel-core/view-base.cjs.map +1 -0
- package/gel-core/view-base.d.cts +8 -0
- package/gel-core/view-base.d.ts +8 -0
- package/gel-core/view-base.js +9 -0
- package/gel-core/view-base.js.map +1 -0
- package/gel-core/view-common.cjs +29 -0
- package/gel-core/view-common.cjs.map +1 -0
- package/gel-core/view-common.d.cts +1 -0
- package/gel-core/view-common.d.ts +1 -0
- package/gel-core/view-common.js +5 -0
- package/gel-core/view-common.js.map +1 -0
- package/gel-core/view.cjs +302 -0
- package/gel-core/view.cjs.map +1 -0
- package/gel-core/view.d.cts +150 -0
- package/gel-core/view.d.ts +150 -0
- package/gel-core/view.js +268 -0
- package/gel-core/view.js.map +1 -0
- package/package.json +1066 -321
- package/pg-core/table.cjs +2 -0
- package/pg-core/table.cjs.map +1 -1
- package/pg-core/table.js +2 -0
- package/pg-core/table.js.map +1 -1
- package/table.cjs.map +1 -1
- package/table.js.map +1 -1
- package/version.cjs +1 -1
- package/version.d.cts +1 -1
- package/version.d.ts +1 -1
- package/version.js +1 -1
|
@@ -0,0 +1,155 @@
|
|
|
1
|
+
import type { ColumnBuilderBaseConfig } from "../../column-builder.js";
|
|
2
|
+
import type { ColumnBaseConfig } from "../../column.js";
|
|
3
|
+
import { entityKind } from "../../entity.js";
|
|
4
|
+
import type { AnyGelTable } from "../table.js";
|
|
5
|
+
import type { SQL } from "../../sql/sql.js";
|
|
6
|
+
import { type Equal } from "../../utils.js";
|
|
7
|
+
import { GelColumn, GelColumnBuilder } from "./common.js";
|
|
8
|
+
export type ConvertCustomConfig<TName extends string, T extends Partial<CustomTypeValues>> = {
|
|
9
|
+
name: TName;
|
|
10
|
+
dataType: 'custom';
|
|
11
|
+
columnType: 'GelCustomColumn';
|
|
12
|
+
data: T['data'];
|
|
13
|
+
driverParam: T['driverData'];
|
|
14
|
+
enumValues: undefined;
|
|
15
|
+
} & (T['notNull'] extends true ? {
|
|
16
|
+
notNull: true;
|
|
17
|
+
} : {}) & (T['default'] extends true ? {
|
|
18
|
+
hasDefault: true;
|
|
19
|
+
} : {});
|
|
20
|
+
export interface GelCustomColumnInnerConfig {
|
|
21
|
+
customTypeValues: CustomTypeValues;
|
|
22
|
+
}
|
|
23
|
+
export declare class GelCustomColumnBuilder<T extends ColumnBuilderBaseConfig<'custom', 'GelCustomColumn'>> extends GelColumnBuilder<T, {
|
|
24
|
+
fieldConfig: CustomTypeValues['config'];
|
|
25
|
+
customTypeParams: CustomTypeParams<any>;
|
|
26
|
+
}, {
|
|
27
|
+
gelColumnBuilderBrand: 'GelCustomColumnBuilderBrand';
|
|
28
|
+
}> {
|
|
29
|
+
static readonly [entityKind]: string;
|
|
30
|
+
constructor(name: T['name'], fieldConfig: CustomTypeValues['config'], customTypeParams: CustomTypeParams<any>);
|
|
31
|
+
}
|
|
32
|
+
export declare class GelCustomColumn<T extends ColumnBaseConfig<'custom', 'GelCustomColumn'>> extends GelColumn<T> {
|
|
33
|
+
static readonly [entityKind]: string;
|
|
34
|
+
private sqlName;
|
|
35
|
+
private mapTo?;
|
|
36
|
+
private mapFrom?;
|
|
37
|
+
constructor(table: AnyGelTable<{
|
|
38
|
+
name: T['tableName'];
|
|
39
|
+
}>, config: GelCustomColumnBuilder<T>['config']);
|
|
40
|
+
getSQLType(): string;
|
|
41
|
+
mapFromDriverValue(value: T['driverParam']): T['data'];
|
|
42
|
+
mapToDriverValue(value: T['data']): T['driverParam'];
|
|
43
|
+
}
|
|
44
|
+
export type CustomTypeValues = {
|
|
45
|
+
/**
|
|
46
|
+
* Required type for custom column, that will infer proper type model
|
|
47
|
+
*
|
|
48
|
+
* Examples:
|
|
49
|
+
*
|
|
50
|
+
* If you want your column to be `string` type after selecting/or on inserting - use `data: string`. Like `text`, `varchar`
|
|
51
|
+
*
|
|
52
|
+
* If you want your column to be `number` type after selecting/or on inserting - use `data: number`. Like `integer`
|
|
53
|
+
*/
|
|
54
|
+
data: unknown;
|
|
55
|
+
/**
|
|
56
|
+
* Type helper, that represents what type database driver is accepting for specific database data type
|
|
57
|
+
*/
|
|
58
|
+
driverData?: unknown;
|
|
59
|
+
/**
|
|
60
|
+
* What config type should be used for {@link CustomTypeParams} `dataType` generation
|
|
61
|
+
*/
|
|
62
|
+
config?: Record<string, any>;
|
|
63
|
+
/**
|
|
64
|
+
* Whether the config argument should be required or not
|
|
65
|
+
* @default false
|
|
66
|
+
*/
|
|
67
|
+
configRequired?: boolean;
|
|
68
|
+
/**
|
|
69
|
+
* If your custom data type should be notNull by default you can use `notNull: true`
|
|
70
|
+
*
|
|
71
|
+
* @example
|
|
72
|
+
* const customSerial = customType<{ data: number, notNull: true, default: true }>({
|
|
73
|
+
* dataType() {
|
|
74
|
+
* return 'serial';
|
|
75
|
+
* },
|
|
76
|
+
* });
|
|
77
|
+
*/
|
|
78
|
+
notNull?: boolean;
|
|
79
|
+
/**
|
|
80
|
+
* If your custom data type has default you can use `default: true`
|
|
81
|
+
*
|
|
82
|
+
* @example
|
|
83
|
+
* const customSerial = customType<{ data: number, notNull: true, default: true }>({
|
|
84
|
+
* dataType() {
|
|
85
|
+
* return 'serial';
|
|
86
|
+
* },
|
|
87
|
+
* });
|
|
88
|
+
*/
|
|
89
|
+
default?: boolean;
|
|
90
|
+
};
|
|
91
|
+
export interface CustomTypeParams<T extends CustomTypeValues> {
|
|
92
|
+
/**
|
|
93
|
+
* Database data type string representation, that is used for migrations
|
|
94
|
+
* @example
|
|
95
|
+
* ```
|
|
96
|
+
* `jsonb`, `text`
|
|
97
|
+
* ```
|
|
98
|
+
*
|
|
99
|
+
* If database data type needs additional params you can use them from `config` param
|
|
100
|
+
* @example
|
|
101
|
+
* ```
|
|
102
|
+
* `varchar(256)`, `numeric(2,3)`
|
|
103
|
+
* ```
|
|
104
|
+
*
|
|
105
|
+
* To make `config` be of specific type please use config generic in {@link CustomTypeValues}
|
|
106
|
+
*
|
|
107
|
+
* @example
|
|
108
|
+
* Usage example
|
|
109
|
+
* ```
|
|
110
|
+
* dataType() {
|
|
111
|
+
* return 'boolean';
|
|
112
|
+
* },
|
|
113
|
+
* ```
|
|
114
|
+
* Or
|
|
115
|
+
* ```
|
|
116
|
+
* dataType(config) {
|
|
117
|
+
* return typeof config.length !== 'undefined' ? `varchar(${config.length})` : `varchar`;
|
|
118
|
+
* }
|
|
119
|
+
* ```
|
|
120
|
+
*/
|
|
121
|
+
dataType: (config: T['config'] | (Equal<T['configRequired'], true> extends true ? never : undefined)) => string;
|
|
122
|
+
/**
|
|
123
|
+
* Optional mapping function, between user input and driver
|
|
124
|
+
* @example
|
|
125
|
+
* For example, when using jsonb we need to map JS/TS object to string before writing to database
|
|
126
|
+
* ```
|
|
127
|
+
* toDriver(value: TData): string {
|
|
128
|
+
* return JSON.stringify(value);
|
|
129
|
+
* }
|
|
130
|
+
* ```
|
|
131
|
+
*/
|
|
132
|
+
toDriver?: (value: T['data']) => T['driverData'] | SQL;
|
|
133
|
+
/**
|
|
134
|
+
* Optional mapping function, that is responsible for data mapping from database to JS/TS code
|
|
135
|
+
* @example
|
|
136
|
+
* For example, when using timestamp we need to map string Date representation to JS Date
|
|
137
|
+
* ```
|
|
138
|
+
* fromDriver(value: string): Date {
|
|
139
|
+
* return new Date(value);
|
|
140
|
+
* },
|
|
141
|
+
* ```
|
|
142
|
+
*/
|
|
143
|
+
fromDriver?: (value: T['driverData']) => T['data'];
|
|
144
|
+
}
|
|
145
|
+
/**
|
|
146
|
+
* Custom gel database data type generator
|
|
147
|
+
*/
|
|
148
|
+
export declare function customType<T extends CustomTypeValues = CustomTypeValues>(customTypeParams: CustomTypeParams<T>): Equal<T['configRequired'], true> extends true ? {
|
|
149
|
+
<TConfig extends Record<string, any> & T['config']>(fieldConfig: TConfig): GelCustomColumnBuilder<ConvertCustomConfig<'', T>>;
|
|
150
|
+
<TName extends string>(dbName: TName, fieldConfig: T['config']): GelCustomColumnBuilder<ConvertCustomConfig<TName, T>>;
|
|
151
|
+
} : {
|
|
152
|
+
(): GelCustomColumnBuilder<ConvertCustomConfig<'', T>>;
|
|
153
|
+
<TConfig extends Record<string, any> & T['config']>(fieldConfig?: TConfig): GelCustomColumnBuilder<ConvertCustomConfig<'', T>>;
|
|
154
|
+
<TName extends string>(dbName: TName, fieldConfig?: T['config']): GelCustomColumnBuilder<ConvertCustomConfig<TName, T>>;
|
|
155
|
+
};
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
import { entityKind } from "../../entity.js";
|
|
2
|
+
import { getColumnNameAndConfig } from "../../utils.js";
|
|
3
|
+
import { GelColumn, GelColumnBuilder } from "./common.js";
|
|
4
|
+
class GelCustomColumnBuilder extends GelColumnBuilder {
|
|
5
|
+
static [entityKind] = "GelCustomColumnBuilder";
|
|
6
|
+
constructor(name, fieldConfig, customTypeParams) {
|
|
7
|
+
super(name, "custom", "GelCustomColumn");
|
|
8
|
+
this.config.fieldConfig = fieldConfig;
|
|
9
|
+
this.config.customTypeParams = customTypeParams;
|
|
10
|
+
}
|
|
11
|
+
/** @internal */
|
|
12
|
+
build(table) {
|
|
13
|
+
return new GelCustomColumn(
|
|
14
|
+
table,
|
|
15
|
+
this.config
|
|
16
|
+
);
|
|
17
|
+
}
|
|
18
|
+
}
|
|
19
|
+
class GelCustomColumn extends GelColumn {
|
|
20
|
+
static [entityKind] = "GelCustomColumn";
|
|
21
|
+
sqlName;
|
|
22
|
+
mapTo;
|
|
23
|
+
mapFrom;
|
|
24
|
+
constructor(table, config) {
|
|
25
|
+
super(table, config);
|
|
26
|
+
this.sqlName = config.customTypeParams.dataType(config.fieldConfig);
|
|
27
|
+
this.mapTo = config.customTypeParams.toDriver;
|
|
28
|
+
this.mapFrom = config.customTypeParams.fromDriver;
|
|
29
|
+
}
|
|
30
|
+
getSQLType() {
|
|
31
|
+
return this.sqlName;
|
|
32
|
+
}
|
|
33
|
+
mapFromDriverValue(value) {
|
|
34
|
+
return typeof this.mapFrom === "function" ? this.mapFrom(value) : value;
|
|
35
|
+
}
|
|
36
|
+
mapToDriverValue(value) {
|
|
37
|
+
return typeof this.mapTo === "function" ? this.mapTo(value) : value;
|
|
38
|
+
}
|
|
39
|
+
}
|
|
40
|
+
function customType(customTypeParams) {
|
|
41
|
+
return (a, b) => {
|
|
42
|
+
const { name, config } = getColumnNameAndConfig(a, b);
|
|
43
|
+
return new GelCustomColumnBuilder(name, config, customTypeParams);
|
|
44
|
+
};
|
|
45
|
+
}
|
|
46
|
+
export {
|
|
47
|
+
GelCustomColumn,
|
|
48
|
+
GelCustomColumnBuilder,
|
|
49
|
+
customType
|
|
50
|
+
};
|
|
51
|
+
//# sourceMappingURL=custom.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../../src/gel-core/columns/custom.ts"],"sourcesContent":["import type { ColumnBuilderBaseConfig, ColumnBuilderRuntimeConfig, MakeColumnConfig } from '~/column-builder.ts';\nimport type { ColumnBaseConfig } from '~/column.ts';\nimport { entityKind } from '~/entity.ts';\nimport type { AnyGelTable } from '~/gel-core/table.ts';\nimport type { SQL } from '~/sql/sql.ts';\nimport { type Equal, getColumnNameAndConfig } from '~/utils.ts';\nimport { GelColumn, GelColumnBuilder } from './common.ts';\n\nexport type ConvertCustomConfig<TName extends string, T extends Partial<CustomTypeValues>> =\n\t& {\n\t\tname: TName;\n\t\tdataType: 'custom';\n\t\tcolumnType: 'GelCustomColumn';\n\t\tdata: T['data'];\n\t\tdriverParam: T['driverData'];\n\t\tenumValues: undefined;\n\t}\n\t& (T['notNull'] extends true ? { notNull: true } : {})\n\t& (T['default'] extends true ? { hasDefault: true } : {});\n\nexport interface GelCustomColumnInnerConfig {\n\tcustomTypeValues: CustomTypeValues;\n}\n\nexport class GelCustomColumnBuilder<T extends ColumnBuilderBaseConfig<'custom', 'GelCustomColumn'>>\n\textends GelColumnBuilder<\n\t\tT,\n\t\t{\n\t\t\tfieldConfig: CustomTypeValues['config'];\n\t\t\tcustomTypeParams: CustomTypeParams<any>;\n\t\t},\n\t\t{\n\t\t\tgelColumnBuilderBrand: 'GelCustomColumnBuilderBrand';\n\t\t}\n\t>\n{\n\tstatic override readonly [entityKind]: string = 'GelCustomColumnBuilder';\n\n\tconstructor(\n\t\tname: T['name'],\n\t\tfieldConfig: CustomTypeValues['config'],\n\t\tcustomTypeParams: CustomTypeParams<any>,\n\t) {\n\t\tsuper(name, 'custom', 'GelCustomColumn');\n\t\tthis.config.fieldConfig = fieldConfig;\n\t\tthis.config.customTypeParams = customTypeParams;\n\t}\n\n\t/** @internal */\n\tbuild<TTableName extends string>(\n\t\ttable: AnyGelTable<{ name: TTableName }>,\n\t): GelCustomColumn<MakeColumnConfig<T, TTableName>> {\n\t\treturn new GelCustomColumn<MakeColumnConfig<T, TTableName>>(\n\t\t\ttable,\n\t\t\tthis.config as ColumnBuilderRuntimeConfig<any, any>,\n\t\t);\n\t}\n}\n\nexport class GelCustomColumn<T extends ColumnBaseConfig<'custom', 'GelCustomColumn'>> extends GelColumn<T> {\n\tstatic override readonly [entityKind]: string = 'GelCustomColumn';\n\n\tprivate sqlName: string;\n\tprivate mapTo?: (value: T['data']) => T['driverParam'];\n\tprivate mapFrom?: (value: T['driverParam']) => T['data'];\n\n\tconstructor(\n\t\ttable: AnyGelTable<{ name: T['tableName'] }>,\n\t\tconfig: GelCustomColumnBuilder<T>['config'],\n\t) {\n\t\tsuper(table, config);\n\t\tthis.sqlName = config.customTypeParams.dataType(config.fieldConfig);\n\t\tthis.mapTo = config.customTypeParams.toDriver;\n\t\tthis.mapFrom = config.customTypeParams.fromDriver;\n\t}\n\n\tgetSQLType(): string {\n\t\treturn this.sqlName;\n\t}\n\n\toverride mapFromDriverValue(value: T['driverParam']): T['data'] {\n\t\treturn typeof this.mapFrom === 'function' ? this.mapFrom(value) : value as T['data'];\n\t}\n\n\toverride mapToDriverValue(value: T['data']): T['driverParam'] {\n\t\treturn typeof this.mapTo === 'function' ? this.mapTo(value) : value as T['data'];\n\t}\n}\n\nexport type CustomTypeValues = {\n\t/**\n\t * Required type for custom column, that will infer proper type model\n\t *\n\t * Examples:\n\t *\n\t * If you want your column to be `string` type after selecting/or on inserting - use `data: string`. Like `text`, `varchar`\n\t *\n\t * If you want your column to be `number` type after selecting/or on inserting - use `data: number`. Like `integer`\n\t */\n\tdata: unknown;\n\n\t/**\n\t * Type helper, that represents what type database driver is accepting for specific database data type\n\t */\n\tdriverData?: unknown;\n\n\t/**\n\t * What config type should be used for {@link CustomTypeParams} `dataType` generation\n\t */\n\tconfig?: Record<string, any>;\n\n\t/**\n\t * Whether the config argument should be required or not\n\t * @default false\n\t */\n\tconfigRequired?: boolean;\n\n\t/**\n\t * If your custom data type should be notNull by default you can use `notNull: true`\n\t *\n\t * @example\n\t * const customSerial = customType<{ data: number, notNull: true, default: true }>({\n\t * \t dataType() {\n\t * \t return 'serial';\n\t * },\n\t * });\n\t */\n\tnotNull?: boolean;\n\n\t/**\n\t * If your custom data type has default you can use `default: true`\n\t *\n\t * @example\n\t * const customSerial = customType<{ data: number, notNull: true, default: true }>({\n\t * \t dataType() {\n\t * \t return 'serial';\n\t * },\n\t * });\n\t */\n\tdefault?: boolean;\n};\n\nexport interface CustomTypeParams<T extends CustomTypeValues> {\n\t/**\n\t * Database data type string representation, that is used for migrations\n\t * @example\n\t * ```\n\t * `jsonb`, `text`\n\t * ```\n\t *\n\t * If database data type needs additional params you can use them from `config` param\n\t * @example\n\t * ```\n\t * `varchar(256)`, `numeric(2,3)`\n\t * ```\n\t *\n\t * To make `config` be of specific type please use config generic in {@link CustomTypeValues}\n\t *\n\t * @example\n\t * Usage example\n\t * ```\n\t * dataType() {\n\t * return 'boolean';\n\t * },\n\t * ```\n\t * Or\n\t * ```\n\t * dataType(config) {\n\t * \t return typeof config.length !== 'undefined' ? `varchar(${config.length})` : `varchar`;\n\t * \t }\n\t * ```\n\t */\n\tdataType: (config: T['config'] | (Equal<T['configRequired'], true> extends true ? never : undefined)) => string;\n\n\t/**\n\t * Optional mapping function, between user input and driver\n\t * @example\n\t * For example, when using jsonb we need to map JS/TS object to string before writing to database\n\t * ```\n\t * toDriver(value: TData): string {\n\t * \t return JSON.stringify(value);\n\t * }\n\t * ```\n\t */\n\ttoDriver?: (value: T['data']) => T['driverData'] | SQL;\n\n\t/**\n\t * Optional mapping function, that is responsible for data mapping from database to JS/TS code\n\t * @example\n\t * For example, when using timestamp we need to map string Date representation to JS Date\n\t * ```\n\t * fromDriver(value: string): Date {\n\t * \treturn new Date(value);\n\t * },\n\t * ```\n\t */\n\tfromDriver?: (value: T['driverData']) => T['data'];\n}\n\n/**\n * Custom gel database data type generator\n */\nexport function customType<T extends CustomTypeValues = CustomTypeValues>(\n\tcustomTypeParams: CustomTypeParams<T>,\n): Equal<T['configRequired'], true> extends true ? {\n\t\t<TConfig extends Record<string, any> & T['config']>(\n\t\t\tfieldConfig: TConfig,\n\t\t): GelCustomColumnBuilder<ConvertCustomConfig<'', T>>;\n\t\t<TName extends string>(\n\t\t\tdbName: TName,\n\t\t\tfieldConfig: T['config'],\n\t\t): GelCustomColumnBuilder<ConvertCustomConfig<TName, T>>;\n\t}\n\t: {\n\t\t(): GelCustomColumnBuilder<ConvertCustomConfig<'', T>>;\n\t\t<TConfig extends Record<string, any> & T['config']>(\n\t\t\tfieldConfig?: TConfig,\n\t\t): GelCustomColumnBuilder<ConvertCustomConfig<'', T>>;\n\t\t<TName extends string>(\n\t\t\tdbName: TName,\n\t\t\tfieldConfig?: T['config'],\n\t\t): GelCustomColumnBuilder<ConvertCustomConfig<TName, T>>;\n\t}\n{\n\treturn <TName extends string>(\n\t\ta?: TName | T['config'],\n\t\tb?: T['config'],\n\t): GelCustomColumnBuilder<ConvertCustomConfig<TName, T>> => {\n\t\tconst { name, config } = getColumnNameAndConfig<T['config']>(a, b);\n\t\treturn new GelCustomColumnBuilder(name as ConvertCustomConfig<TName, T>['name'], config, customTypeParams);\n\t};\n}\n"],"mappings":"AAEA,SAAS,kBAAkB;AAG3B,SAAqB,8BAA8B;AACnD,SAAS,WAAW,wBAAwB;AAkBrC,MAAM,+BACJ,iBAUT;AAAA,EACC,QAA0B,UAAU,IAAY;AAAA,EAEhD,YACC,MACA,aACA,kBACC;AACD,UAAM,MAAM,UAAU,iBAAiB;AACvC,SAAK,OAAO,cAAc;AAC1B,SAAK,OAAO,mBAAmB;AAAA,EAChC;AAAA;AAAA,EAGA,MACC,OACmD;AACnD,WAAO,IAAI;AAAA,MACV;AAAA,MACA,KAAK;AAAA,IACN;AAAA,EACD;AACD;AAEO,MAAM,wBAAiF,UAAa;AAAA,EAC1G,QAA0B,UAAU,IAAY;AAAA,EAExC;AAAA,EACA;AAAA,EACA;AAAA,EAER,YACC,OACA,QACC;AACD,UAAM,OAAO,MAAM;AACnB,SAAK,UAAU,OAAO,iBAAiB,SAAS,OAAO,WAAW;AAClE,SAAK,QAAQ,OAAO,iBAAiB;AACrC,SAAK,UAAU,OAAO,iBAAiB;AAAA,EACxC;AAAA,EAEA,aAAqB;AACpB,WAAO,KAAK;AAAA,EACb;AAAA,EAES,mBAAmB,OAAoC;AAC/D,WAAO,OAAO,KAAK,YAAY,aAAa,KAAK,QAAQ,KAAK,IAAI;AAAA,EACnE;AAAA,EAES,iBAAiB,OAAoC;AAC7D,WAAO,OAAO,KAAK,UAAU,aAAa,KAAK,MAAM,KAAK,IAAI;AAAA,EAC/D;AACD;AAmHO,SAAS,WACf,kBAoBD;AACC,SAAO,CACN,GACA,MAC2D;AAC3D,UAAM,EAAE,MAAM,OAAO,IAAI,uBAAoC,GAAG,CAAC;AACjE,WAAO,IAAI,uBAAuB,MAA+C,QAAQ,gBAAgB;AAAA,EAC1G;AACD;","names":[]}
|
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __defProp = Object.defineProperty;
|
|
3
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
6
|
+
var __export = (target, all) => {
|
|
7
|
+
for (var name in all)
|
|
8
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
9
|
+
};
|
|
10
|
+
var __copyProps = (to, from, except, desc) => {
|
|
11
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
12
|
+
for (let key of __getOwnPropNames(from))
|
|
13
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
14
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
15
|
+
}
|
|
16
|
+
return to;
|
|
17
|
+
};
|
|
18
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
19
|
+
var date_duration_exports = {};
|
|
20
|
+
__export(date_duration_exports, {
|
|
21
|
+
GelDateDuration: () => GelDateDuration,
|
|
22
|
+
GelDateDurationBuilder: () => GelDateDurationBuilder,
|
|
23
|
+
dateDuration: () => dateDuration
|
|
24
|
+
});
|
|
25
|
+
module.exports = __toCommonJS(date_duration_exports);
|
|
26
|
+
var import_entity = require("../../entity.cjs");
|
|
27
|
+
var import_common = require("./common.cjs");
|
|
28
|
+
class GelDateDurationBuilder extends import_common.GelColumnBuilder {
|
|
29
|
+
static [import_entity.entityKind] = "GelDateDurationBuilder";
|
|
30
|
+
constructor(name) {
|
|
31
|
+
super(name, "dateDuration", "GelDateDuration");
|
|
32
|
+
}
|
|
33
|
+
/** @internal */
|
|
34
|
+
build(table) {
|
|
35
|
+
return new GelDateDuration(
|
|
36
|
+
table,
|
|
37
|
+
this.config
|
|
38
|
+
);
|
|
39
|
+
}
|
|
40
|
+
}
|
|
41
|
+
class GelDateDuration extends import_common.GelColumn {
|
|
42
|
+
static [import_entity.entityKind] = "GelDateDuration";
|
|
43
|
+
getSQLType() {
|
|
44
|
+
return `dateDuration`;
|
|
45
|
+
}
|
|
46
|
+
}
|
|
47
|
+
function dateDuration(name) {
|
|
48
|
+
return new GelDateDurationBuilder(name ?? "");
|
|
49
|
+
}
|
|
50
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
51
|
+
0 && (module.exports = {
|
|
52
|
+
GelDateDuration,
|
|
53
|
+
GelDateDurationBuilder,
|
|
54
|
+
dateDuration
|
|
55
|
+
});
|
|
56
|
+
//# sourceMappingURL=date-duration.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../../src/gel-core/columns/date-duration.ts"],"sourcesContent":["import type { DateDuration } from 'gel';\nimport type { ColumnBuilderBaseConfig, ColumnBuilderRuntimeConfig, MakeColumnConfig } from '~/column-builder.ts';\nimport type { ColumnBaseConfig } from '~/column.ts';\nimport { entityKind } from '~/entity.ts';\nimport type { AnyGelTable } from '~/gel-core/table.ts';\nimport { GelColumn, GelColumnBuilder } from './common.ts';\n\nexport type GelDateDurationBuilderInitial<TName extends string> = GelDateDurationBuilder<{\n\tname: TName;\n\tdataType: 'dateDuration';\n\tcolumnType: 'GelDateDuration';\n\tdata: DateDuration;\n\tdriverParam: DateDuration;\n\tenumValues: undefined;\n}>;\n\nexport class GelDateDurationBuilder<T extends ColumnBuilderBaseConfig<'dateDuration', 'GelDateDuration'>>\n\textends GelColumnBuilder<T>\n{\n\tstatic override readonly [entityKind]: string = 'GelDateDurationBuilder';\n\n\tconstructor(\n\t\tname: T['name'],\n\t) {\n\t\tsuper(name, 'dateDuration', 'GelDateDuration');\n\t}\n\n\t/** @internal */\n\toverride build<TTableName extends string>(\n\t\ttable: AnyGelTable<{ name: TTableName }>,\n\t): GelDateDuration<MakeColumnConfig<T, TTableName>> {\n\t\treturn new GelDateDuration<MakeColumnConfig<T, TTableName>>(\n\t\t\ttable,\n\t\t\tthis.config as ColumnBuilderRuntimeConfig<any, any>,\n\t\t);\n\t}\n}\n\nexport class GelDateDuration<T extends ColumnBaseConfig<'dateDuration', 'GelDateDuration'>> extends GelColumn<T> {\n\tstatic override readonly [entityKind]: string = 'GelDateDuration';\n\n\tgetSQLType(): string {\n\t\treturn `dateDuration`;\n\t}\n}\n\nexport function dateDuration(): GelDateDurationBuilderInitial<''>;\nexport function dateDuration<TName extends string>(name: TName): GelDateDurationBuilderInitial<TName>;\nexport function dateDuration(name?: string) {\n\treturn new GelDateDurationBuilder(name ?? '');\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAGA,oBAA2B;AAE3B,oBAA4C;AAWrC,MAAM,+BACJ,+BACT;AAAA,EACC,QAA0B,wBAAU,IAAY;AAAA,EAEhD,YACC,MACC;AACD,UAAM,MAAM,gBAAgB,iBAAiB;AAAA,EAC9C;AAAA;AAAA,EAGS,MACR,OACmD;AACnD,WAAO,IAAI;AAAA,MACV;AAAA,MACA,KAAK;AAAA,IACN;AAAA,EACD;AACD;AAEO,MAAM,wBAAuF,wBAAa;AAAA,EAChH,QAA0B,wBAAU,IAAY;AAAA,EAEhD,aAAqB;AACpB,WAAO;AAAA,EACR;AACD;AAIO,SAAS,aAAa,MAAe;AAC3C,SAAO,IAAI,uBAAuB,QAAQ,EAAE;AAC7C;","names":[]}
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import type { DateDuration } from 'gel';
|
|
2
|
+
import type { ColumnBuilderBaseConfig } from "../../column-builder.cjs";
|
|
3
|
+
import type { ColumnBaseConfig } from "../../column.cjs";
|
|
4
|
+
import { entityKind } from "../../entity.cjs";
|
|
5
|
+
import { GelColumn, GelColumnBuilder } from "./common.cjs";
|
|
6
|
+
export type GelDateDurationBuilderInitial<TName extends string> = GelDateDurationBuilder<{
|
|
7
|
+
name: TName;
|
|
8
|
+
dataType: 'dateDuration';
|
|
9
|
+
columnType: 'GelDateDuration';
|
|
10
|
+
data: DateDuration;
|
|
11
|
+
driverParam: DateDuration;
|
|
12
|
+
enumValues: undefined;
|
|
13
|
+
}>;
|
|
14
|
+
export declare class GelDateDurationBuilder<T extends ColumnBuilderBaseConfig<'dateDuration', 'GelDateDuration'>> extends GelColumnBuilder<T> {
|
|
15
|
+
static readonly [entityKind]: string;
|
|
16
|
+
constructor(name: T['name']);
|
|
17
|
+
}
|
|
18
|
+
export declare class GelDateDuration<T extends ColumnBaseConfig<'dateDuration', 'GelDateDuration'>> extends GelColumn<T> {
|
|
19
|
+
static readonly [entityKind]: string;
|
|
20
|
+
getSQLType(): string;
|
|
21
|
+
}
|
|
22
|
+
export declare function dateDuration(): GelDateDurationBuilderInitial<''>;
|
|
23
|
+
export declare function dateDuration<TName extends string>(name: TName): GelDateDurationBuilderInitial<TName>;
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import type { DateDuration } from 'gel';
|
|
2
|
+
import type { ColumnBuilderBaseConfig } from "../../column-builder.js";
|
|
3
|
+
import type { ColumnBaseConfig } from "../../column.js";
|
|
4
|
+
import { entityKind } from "../../entity.js";
|
|
5
|
+
import { GelColumn, GelColumnBuilder } from "./common.js";
|
|
6
|
+
export type GelDateDurationBuilderInitial<TName extends string> = GelDateDurationBuilder<{
|
|
7
|
+
name: TName;
|
|
8
|
+
dataType: 'dateDuration';
|
|
9
|
+
columnType: 'GelDateDuration';
|
|
10
|
+
data: DateDuration;
|
|
11
|
+
driverParam: DateDuration;
|
|
12
|
+
enumValues: undefined;
|
|
13
|
+
}>;
|
|
14
|
+
export declare class GelDateDurationBuilder<T extends ColumnBuilderBaseConfig<'dateDuration', 'GelDateDuration'>> extends GelColumnBuilder<T> {
|
|
15
|
+
static readonly [entityKind]: string;
|
|
16
|
+
constructor(name: T['name']);
|
|
17
|
+
}
|
|
18
|
+
export declare class GelDateDuration<T extends ColumnBaseConfig<'dateDuration', 'GelDateDuration'>> extends GelColumn<T> {
|
|
19
|
+
static readonly [entityKind]: string;
|
|
20
|
+
getSQLType(): string;
|
|
21
|
+
}
|
|
22
|
+
export declare function dateDuration(): GelDateDurationBuilderInitial<''>;
|
|
23
|
+
export declare function dateDuration<TName extends string>(name: TName): GelDateDurationBuilderInitial<TName>;
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
import { entityKind } from "../../entity.js";
|
|
2
|
+
import { GelColumn, GelColumnBuilder } from "./common.js";
|
|
3
|
+
class GelDateDurationBuilder extends GelColumnBuilder {
|
|
4
|
+
static [entityKind] = "GelDateDurationBuilder";
|
|
5
|
+
constructor(name) {
|
|
6
|
+
super(name, "dateDuration", "GelDateDuration");
|
|
7
|
+
}
|
|
8
|
+
/** @internal */
|
|
9
|
+
build(table) {
|
|
10
|
+
return new GelDateDuration(
|
|
11
|
+
table,
|
|
12
|
+
this.config
|
|
13
|
+
);
|
|
14
|
+
}
|
|
15
|
+
}
|
|
16
|
+
class GelDateDuration extends GelColumn {
|
|
17
|
+
static [entityKind] = "GelDateDuration";
|
|
18
|
+
getSQLType() {
|
|
19
|
+
return `dateDuration`;
|
|
20
|
+
}
|
|
21
|
+
}
|
|
22
|
+
function dateDuration(name) {
|
|
23
|
+
return new GelDateDurationBuilder(name ?? "");
|
|
24
|
+
}
|
|
25
|
+
export {
|
|
26
|
+
GelDateDuration,
|
|
27
|
+
GelDateDurationBuilder,
|
|
28
|
+
dateDuration
|
|
29
|
+
};
|
|
30
|
+
//# sourceMappingURL=date-duration.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../../src/gel-core/columns/date-duration.ts"],"sourcesContent":["import type { DateDuration } from 'gel';\nimport type { ColumnBuilderBaseConfig, ColumnBuilderRuntimeConfig, MakeColumnConfig } from '~/column-builder.ts';\nimport type { ColumnBaseConfig } from '~/column.ts';\nimport { entityKind } from '~/entity.ts';\nimport type { AnyGelTable } from '~/gel-core/table.ts';\nimport { GelColumn, GelColumnBuilder } from './common.ts';\n\nexport type GelDateDurationBuilderInitial<TName extends string> = GelDateDurationBuilder<{\n\tname: TName;\n\tdataType: 'dateDuration';\n\tcolumnType: 'GelDateDuration';\n\tdata: DateDuration;\n\tdriverParam: DateDuration;\n\tenumValues: undefined;\n}>;\n\nexport class GelDateDurationBuilder<T extends ColumnBuilderBaseConfig<'dateDuration', 'GelDateDuration'>>\n\textends GelColumnBuilder<T>\n{\n\tstatic override readonly [entityKind]: string = 'GelDateDurationBuilder';\n\n\tconstructor(\n\t\tname: T['name'],\n\t) {\n\t\tsuper(name, 'dateDuration', 'GelDateDuration');\n\t}\n\n\t/** @internal */\n\toverride build<TTableName extends string>(\n\t\ttable: AnyGelTable<{ name: TTableName }>,\n\t): GelDateDuration<MakeColumnConfig<T, TTableName>> {\n\t\treturn new GelDateDuration<MakeColumnConfig<T, TTableName>>(\n\t\t\ttable,\n\t\t\tthis.config as ColumnBuilderRuntimeConfig<any, any>,\n\t\t);\n\t}\n}\n\nexport class GelDateDuration<T extends ColumnBaseConfig<'dateDuration', 'GelDateDuration'>> extends GelColumn<T> {\n\tstatic override readonly [entityKind]: string = 'GelDateDuration';\n\n\tgetSQLType(): string {\n\t\treturn `dateDuration`;\n\t}\n}\n\nexport function dateDuration(): GelDateDurationBuilderInitial<''>;\nexport function dateDuration<TName extends string>(name: TName): GelDateDurationBuilderInitial<TName>;\nexport function dateDuration(name?: string) {\n\treturn new GelDateDurationBuilder(name ?? '');\n}\n"],"mappings":"AAGA,SAAS,kBAAkB;AAE3B,SAAS,WAAW,wBAAwB;AAWrC,MAAM,+BACJ,iBACT;AAAA,EACC,QAA0B,UAAU,IAAY;AAAA,EAEhD,YACC,MACC;AACD,UAAM,MAAM,gBAAgB,iBAAiB;AAAA,EAC9C;AAAA;AAAA,EAGS,MACR,OACmD;AACnD,WAAO,IAAI;AAAA,MACV;AAAA,MACA,KAAK;AAAA,IACN;AAAA,EACD;AACD;AAEO,MAAM,wBAAuF,UAAa;AAAA,EAChH,QAA0B,UAAU,IAAY;AAAA,EAEhD,aAAqB;AACpB,WAAO;AAAA,EACR;AACD;AAIO,SAAS,aAAa,MAAe;AAC3C,SAAO,IAAI,uBAAuB,QAAQ,EAAE;AAC7C;","names":[]}
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __defProp = Object.defineProperty;
|
|
3
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
6
|
+
var __export = (target, all) => {
|
|
7
|
+
for (var name in all)
|
|
8
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
9
|
+
};
|
|
10
|
+
var __copyProps = (to, from, except, desc) => {
|
|
11
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
12
|
+
for (let key of __getOwnPropNames(from))
|
|
13
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
14
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
15
|
+
}
|
|
16
|
+
return to;
|
|
17
|
+
};
|
|
18
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
19
|
+
var date_common_exports = {};
|
|
20
|
+
__export(date_common_exports, {
|
|
21
|
+
GelLocalDateColumnBaseBuilder: () => GelLocalDateColumnBaseBuilder
|
|
22
|
+
});
|
|
23
|
+
module.exports = __toCommonJS(date_common_exports);
|
|
24
|
+
var import_entity = require("../../entity.cjs");
|
|
25
|
+
var import_sql = require("../../sql/sql.cjs");
|
|
26
|
+
var import_common = require("./common.cjs");
|
|
27
|
+
class GelLocalDateColumnBaseBuilder extends import_common.GelColumnBuilder {
|
|
28
|
+
static [import_entity.entityKind] = "GelLocalDateColumnBaseBuilder";
|
|
29
|
+
defaultNow() {
|
|
30
|
+
return this.default(import_sql.sql`now()`);
|
|
31
|
+
}
|
|
32
|
+
}
|
|
33
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
34
|
+
0 && (module.exports = {
|
|
35
|
+
GelLocalDateColumnBaseBuilder
|
|
36
|
+
});
|
|
37
|
+
//# sourceMappingURL=date.common.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../../src/gel-core/columns/date.common.ts"],"sourcesContent":["import type { ColumnBuilderBaseConfig, ColumnDataType } from '~/column-builder.ts';\nimport { entityKind } from '~/entity.ts';\nimport { sql } from '~/sql/sql.ts';\nimport { GelColumnBuilder } from './common.ts';\n\nexport abstract class GelLocalDateColumnBaseBuilder<\n\tT extends ColumnBuilderBaseConfig<ColumnDataType, string>,\n\tTRuntimeConfig extends object = object,\n> extends GelColumnBuilder<T, TRuntimeConfig> {\n\tstatic override readonly [entityKind]: string = 'GelLocalDateColumnBaseBuilder';\n\n\tdefaultNow() {\n\t\treturn this.default(sql`now()`);\n\t}\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AACA,oBAA2B;AAC3B,iBAAoB;AACpB,oBAAiC;AAE1B,MAAe,sCAGZ,+BAAoC;AAAA,EAC7C,QAA0B,wBAAU,IAAY;AAAA,EAEhD,aAAa;AACZ,WAAO,KAAK,QAAQ,qBAAU;AAAA,EAC/B;AACD;","names":[]}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import type { ColumnBuilderBaseConfig, ColumnDataType } from "../../column-builder.cjs";
|
|
2
|
+
import { entityKind } from "../../entity.cjs";
|
|
3
|
+
import { GelColumnBuilder } from "./common.cjs";
|
|
4
|
+
export declare abstract class GelLocalDateColumnBaseBuilder<T extends ColumnBuilderBaseConfig<ColumnDataType, string>, TRuntimeConfig extends object = object> extends GelColumnBuilder<T, TRuntimeConfig> {
|
|
5
|
+
static readonly [entityKind]: string;
|
|
6
|
+
defaultNow(): import("../../column-builder.ts").HasDefault<this>;
|
|
7
|
+
}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import type { ColumnBuilderBaseConfig, ColumnDataType } from "../../column-builder.js";
|
|
2
|
+
import { entityKind } from "../../entity.js";
|
|
3
|
+
import { GelColumnBuilder } from "./common.js";
|
|
4
|
+
export declare abstract class GelLocalDateColumnBaseBuilder<T extends ColumnBuilderBaseConfig<ColumnDataType, string>, TRuntimeConfig extends object = object> extends GelColumnBuilder<T, TRuntimeConfig> {
|
|
5
|
+
static readonly [entityKind]: string;
|
|
6
|
+
defaultNow(): import("../../column-builder.js").HasDefault<this>;
|
|
7
|
+
}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { entityKind } from "../../entity.js";
|
|
2
|
+
import { sql } from "../../sql/sql.js";
|
|
3
|
+
import { GelColumnBuilder } from "./common.js";
|
|
4
|
+
class GelLocalDateColumnBaseBuilder extends GelColumnBuilder {
|
|
5
|
+
static [entityKind] = "GelLocalDateColumnBaseBuilder";
|
|
6
|
+
defaultNow() {
|
|
7
|
+
return this.default(sql`now()`);
|
|
8
|
+
}
|
|
9
|
+
}
|
|
10
|
+
export {
|
|
11
|
+
GelLocalDateColumnBaseBuilder
|
|
12
|
+
};
|
|
13
|
+
//# sourceMappingURL=date.common.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../../src/gel-core/columns/date.common.ts"],"sourcesContent":["import type { ColumnBuilderBaseConfig, ColumnDataType } from '~/column-builder.ts';\nimport { entityKind } from '~/entity.ts';\nimport { sql } from '~/sql/sql.ts';\nimport { GelColumnBuilder } from './common.ts';\n\nexport abstract class GelLocalDateColumnBaseBuilder<\n\tT extends ColumnBuilderBaseConfig<ColumnDataType, string>,\n\tTRuntimeConfig extends object = object,\n> extends GelColumnBuilder<T, TRuntimeConfig> {\n\tstatic override readonly [entityKind]: string = 'GelLocalDateColumnBaseBuilder';\n\n\tdefaultNow() {\n\t\treturn this.default(sql`now()`);\n\t}\n}\n"],"mappings":"AACA,SAAS,kBAAkB;AAC3B,SAAS,WAAW;AACpB,SAAS,wBAAwB;AAE1B,MAAe,sCAGZ,iBAAoC;AAAA,EAC7C,QAA0B,UAAU,IAAY;AAAA,EAEhD,aAAa;AACZ,WAAO,KAAK,QAAQ,UAAU;AAAA,EAC/B;AACD;","names":[]}
|
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __defProp = Object.defineProperty;
|
|
3
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
6
|
+
var __export = (target, all) => {
|
|
7
|
+
for (var name in all)
|
|
8
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
9
|
+
};
|
|
10
|
+
var __copyProps = (to, from, except, desc) => {
|
|
11
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
12
|
+
for (let key of __getOwnPropNames(from))
|
|
13
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
14
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
15
|
+
}
|
|
16
|
+
return to;
|
|
17
|
+
};
|
|
18
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
19
|
+
var decimal_exports = {};
|
|
20
|
+
__export(decimal_exports, {
|
|
21
|
+
GelDecimal: () => GelDecimal,
|
|
22
|
+
GelDecimalBuilder: () => GelDecimalBuilder,
|
|
23
|
+
decimal: () => decimal
|
|
24
|
+
});
|
|
25
|
+
module.exports = __toCommonJS(decimal_exports);
|
|
26
|
+
var import_entity = require("../../entity.cjs");
|
|
27
|
+
var import_common = require("./common.cjs");
|
|
28
|
+
class GelDecimalBuilder extends import_common.GelColumnBuilder {
|
|
29
|
+
static [import_entity.entityKind] = "GelDecimalBuilder";
|
|
30
|
+
constructor(name) {
|
|
31
|
+
super(name, "string", "GelDecimal");
|
|
32
|
+
}
|
|
33
|
+
/** @internal */
|
|
34
|
+
build(table) {
|
|
35
|
+
return new GelDecimal(table, this.config);
|
|
36
|
+
}
|
|
37
|
+
}
|
|
38
|
+
class GelDecimal extends import_common.GelColumn {
|
|
39
|
+
static [import_entity.entityKind] = "GelDecimal";
|
|
40
|
+
constructor(table, config) {
|
|
41
|
+
super(table, config);
|
|
42
|
+
}
|
|
43
|
+
getSQLType() {
|
|
44
|
+
return "numeric";
|
|
45
|
+
}
|
|
46
|
+
}
|
|
47
|
+
function decimal(name) {
|
|
48
|
+
return new GelDecimalBuilder(name ?? "");
|
|
49
|
+
}
|
|
50
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
51
|
+
0 && (module.exports = {
|
|
52
|
+
GelDecimal,
|
|
53
|
+
GelDecimalBuilder,
|
|
54
|
+
decimal
|
|
55
|
+
});
|
|
56
|
+
//# sourceMappingURL=decimal.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../../src/gel-core/columns/decimal.ts"],"sourcesContent":["import type { ColumnBuilderBaseConfig, ColumnBuilderRuntimeConfig, MakeColumnConfig } from '~/column-builder.ts';\nimport type { ColumnBaseConfig } from '~/column.ts';\nimport { entityKind } from '~/entity.ts';\nimport type { AnyGelTable } from '~/gel-core/table.ts';\nimport { GelColumn, GelColumnBuilder } from './common.ts';\n\nexport type GelDecimalBuilderInitial<TName extends string> = GelDecimalBuilder<{\n\tname: TName;\n\tdataType: 'string';\n\tcolumnType: 'GelDecimal';\n\tdata: string;\n\tdriverParam: string;\n\tenumValues: undefined;\n}>;\n\nexport class GelDecimalBuilder<T extends ColumnBuilderBaseConfig<'string', 'GelDecimal'>> extends GelColumnBuilder<\n\tT\n> {\n\tstatic override readonly [entityKind]: string = 'GelDecimalBuilder';\n\n\tconstructor(name: T['name']) {\n\t\tsuper(name, 'string', 'GelDecimal');\n\t}\n\n\t/** @internal */\n\toverride build<TTableName extends string>(\n\t\ttable: AnyGelTable<{ name: TTableName }>,\n\t): GelDecimal<MakeColumnConfig<T, TTableName>> {\n\t\treturn new GelDecimal<MakeColumnConfig<T, TTableName>>(table, this.config as ColumnBuilderRuntimeConfig<any, any>);\n\t}\n}\n\nexport class GelDecimal<T extends ColumnBaseConfig<'string', 'GelDecimal'>> extends GelColumn<T> {\n\tstatic override readonly [entityKind]: string = 'GelDecimal';\n\n\tconstructor(table: AnyGelTable<{ name: T['tableName'] }>, config: GelDecimalBuilder<T>['config']) {\n\t\tsuper(table, config);\n\t}\n\n\tgetSQLType(): string {\n\t\treturn 'numeric';\n\t}\n}\n\nexport function decimal(): GelDecimalBuilderInitial<''>;\nexport function decimal<TName extends string>(name: TName): GelDecimalBuilderInitial<TName>;\nexport function decimal(name?: string) {\n\treturn new GelDecimalBuilder(name ?? '');\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAEA,oBAA2B;AAE3B,oBAA4C;AAWrC,MAAM,0BAAqF,+BAEhG;AAAA,EACD,QAA0B,wBAAU,IAAY;AAAA,EAEhD,YAAY,MAAiB;AAC5B,UAAM,MAAM,UAAU,YAAY;AAAA,EACnC;AAAA;AAAA,EAGS,MACR,OAC8C;AAC9C,WAAO,IAAI,WAA4C,OAAO,KAAK,MAA8C;AAAA,EAClH;AACD;AAEO,MAAM,mBAAuE,wBAAa;AAAA,EAChG,QAA0B,wBAAU,IAAY;AAAA,EAEhD,YAAY,OAA8C,QAAwC;AACjG,UAAM,OAAO,MAAM;AAAA,EACpB;AAAA,EAEA,aAAqB;AACpB,WAAO;AAAA,EACR;AACD;AAIO,SAAS,QAAQ,MAAe;AACtC,SAAO,IAAI,kBAAkB,QAAQ,EAAE;AACxC;","names":[]}
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import type { ColumnBuilderBaseConfig } from "../../column-builder.cjs";
|
|
2
|
+
import type { ColumnBaseConfig } from "../../column.cjs";
|
|
3
|
+
import { entityKind } from "../../entity.cjs";
|
|
4
|
+
import type { AnyGelTable } from "../table.cjs";
|
|
5
|
+
import { GelColumn, GelColumnBuilder } from "./common.cjs";
|
|
6
|
+
export type GelDecimalBuilderInitial<TName extends string> = GelDecimalBuilder<{
|
|
7
|
+
name: TName;
|
|
8
|
+
dataType: 'string';
|
|
9
|
+
columnType: 'GelDecimal';
|
|
10
|
+
data: string;
|
|
11
|
+
driverParam: string;
|
|
12
|
+
enumValues: undefined;
|
|
13
|
+
}>;
|
|
14
|
+
export declare class GelDecimalBuilder<T extends ColumnBuilderBaseConfig<'string', 'GelDecimal'>> extends GelColumnBuilder<T> {
|
|
15
|
+
static readonly [entityKind]: string;
|
|
16
|
+
constructor(name: T['name']);
|
|
17
|
+
}
|
|
18
|
+
export declare class GelDecimal<T extends ColumnBaseConfig<'string', 'GelDecimal'>> extends GelColumn<T> {
|
|
19
|
+
static readonly [entityKind]: string;
|
|
20
|
+
constructor(table: AnyGelTable<{
|
|
21
|
+
name: T['tableName'];
|
|
22
|
+
}>, config: GelDecimalBuilder<T>['config']);
|
|
23
|
+
getSQLType(): string;
|
|
24
|
+
}
|
|
25
|
+
export declare function decimal(): GelDecimalBuilderInitial<''>;
|
|
26
|
+
export declare function decimal<TName extends string>(name: TName): GelDecimalBuilderInitial<TName>;
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import type { ColumnBuilderBaseConfig } from "../../column-builder.js";
|
|
2
|
+
import type { ColumnBaseConfig } from "../../column.js";
|
|
3
|
+
import { entityKind } from "../../entity.js";
|
|
4
|
+
import type { AnyGelTable } from "../table.js";
|
|
5
|
+
import { GelColumn, GelColumnBuilder } from "./common.js";
|
|
6
|
+
export type GelDecimalBuilderInitial<TName extends string> = GelDecimalBuilder<{
|
|
7
|
+
name: TName;
|
|
8
|
+
dataType: 'string';
|
|
9
|
+
columnType: 'GelDecimal';
|
|
10
|
+
data: string;
|
|
11
|
+
driverParam: string;
|
|
12
|
+
enumValues: undefined;
|
|
13
|
+
}>;
|
|
14
|
+
export declare class GelDecimalBuilder<T extends ColumnBuilderBaseConfig<'string', 'GelDecimal'>> extends GelColumnBuilder<T> {
|
|
15
|
+
static readonly [entityKind]: string;
|
|
16
|
+
constructor(name: T['name']);
|
|
17
|
+
}
|
|
18
|
+
export declare class GelDecimal<T extends ColumnBaseConfig<'string', 'GelDecimal'>> extends GelColumn<T> {
|
|
19
|
+
static readonly [entityKind]: string;
|
|
20
|
+
constructor(table: AnyGelTable<{
|
|
21
|
+
name: T['tableName'];
|
|
22
|
+
}>, config: GelDecimalBuilder<T>['config']);
|
|
23
|
+
getSQLType(): string;
|
|
24
|
+
}
|
|
25
|
+
export declare function decimal(): GelDecimalBuilderInitial<''>;
|
|
26
|
+
export declare function decimal<TName extends string>(name: TName): GelDecimalBuilderInitial<TName>;
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
import { entityKind } from "../../entity.js";
|
|
2
|
+
import { GelColumn, GelColumnBuilder } from "./common.js";
|
|
3
|
+
class GelDecimalBuilder extends GelColumnBuilder {
|
|
4
|
+
static [entityKind] = "GelDecimalBuilder";
|
|
5
|
+
constructor(name) {
|
|
6
|
+
super(name, "string", "GelDecimal");
|
|
7
|
+
}
|
|
8
|
+
/** @internal */
|
|
9
|
+
build(table) {
|
|
10
|
+
return new GelDecimal(table, this.config);
|
|
11
|
+
}
|
|
12
|
+
}
|
|
13
|
+
class GelDecimal extends GelColumn {
|
|
14
|
+
static [entityKind] = "GelDecimal";
|
|
15
|
+
constructor(table, config) {
|
|
16
|
+
super(table, config);
|
|
17
|
+
}
|
|
18
|
+
getSQLType() {
|
|
19
|
+
return "numeric";
|
|
20
|
+
}
|
|
21
|
+
}
|
|
22
|
+
function decimal(name) {
|
|
23
|
+
return new GelDecimalBuilder(name ?? "");
|
|
24
|
+
}
|
|
25
|
+
export {
|
|
26
|
+
GelDecimal,
|
|
27
|
+
GelDecimalBuilder,
|
|
28
|
+
decimal
|
|
29
|
+
};
|
|
30
|
+
//# sourceMappingURL=decimal.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../../src/gel-core/columns/decimal.ts"],"sourcesContent":["import type { ColumnBuilderBaseConfig, ColumnBuilderRuntimeConfig, MakeColumnConfig } from '~/column-builder.ts';\nimport type { ColumnBaseConfig } from '~/column.ts';\nimport { entityKind } from '~/entity.ts';\nimport type { AnyGelTable } from '~/gel-core/table.ts';\nimport { GelColumn, GelColumnBuilder } from './common.ts';\n\nexport type GelDecimalBuilderInitial<TName extends string> = GelDecimalBuilder<{\n\tname: TName;\n\tdataType: 'string';\n\tcolumnType: 'GelDecimal';\n\tdata: string;\n\tdriverParam: string;\n\tenumValues: undefined;\n}>;\n\nexport class GelDecimalBuilder<T extends ColumnBuilderBaseConfig<'string', 'GelDecimal'>> extends GelColumnBuilder<\n\tT\n> {\n\tstatic override readonly [entityKind]: string = 'GelDecimalBuilder';\n\n\tconstructor(name: T['name']) {\n\t\tsuper(name, 'string', 'GelDecimal');\n\t}\n\n\t/** @internal */\n\toverride build<TTableName extends string>(\n\t\ttable: AnyGelTable<{ name: TTableName }>,\n\t): GelDecimal<MakeColumnConfig<T, TTableName>> {\n\t\treturn new GelDecimal<MakeColumnConfig<T, TTableName>>(table, this.config as ColumnBuilderRuntimeConfig<any, any>);\n\t}\n}\n\nexport class GelDecimal<T extends ColumnBaseConfig<'string', 'GelDecimal'>> extends GelColumn<T> {\n\tstatic override readonly [entityKind]: string = 'GelDecimal';\n\n\tconstructor(table: AnyGelTable<{ name: T['tableName'] }>, config: GelDecimalBuilder<T>['config']) {\n\t\tsuper(table, config);\n\t}\n\n\tgetSQLType(): string {\n\t\treturn 'numeric';\n\t}\n}\n\nexport function decimal(): GelDecimalBuilderInitial<''>;\nexport function decimal<TName extends string>(name: TName): GelDecimalBuilderInitial<TName>;\nexport function decimal(name?: string) {\n\treturn new GelDecimalBuilder(name ?? '');\n}\n"],"mappings":"AAEA,SAAS,kBAAkB;AAE3B,SAAS,WAAW,wBAAwB;AAWrC,MAAM,0BAAqF,iBAEhG;AAAA,EACD,QAA0B,UAAU,IAAY;AAAA,EAEhD,YAAY,MAAiB;AAC5B,UAAM,MAAM,UAAU,YAAY;AAAA,EACnC;AAAA;AAAA,EAGS,MACR,OAC8C;AAC9C,WAAO,IAAI,WAA4C,OAAO,KAAK,MAA8C;AAAA,EAClH;AACD;AAEO,MAAM,mBAAuE,UAAa;AAAA,EAChG,QAA0B,UAAU,IAAY;AAAA,EAEhD,YAAY,OAA8C,QAAwC;AACjG,UAAM,OAAO,MAAM;AAAA,EACpB;AAAA,EAEA,aAAqB;AACpB,WAAO;AAAA,EACR;AACD;AAIO,SAAS,QAAQ,MAAe;AACtC,SAAO,IAAI,kBAAkB,QAAQ,EAAE;AACxC;","names":[]}
|