durcno 1.0.0-alpha.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/LICENSE +201 -0
- package/README.md +56 -0
- package/dist/bin.cjs +13522 -0
- package/dist/src/_virtual/_rolldown/runtime.mjs +28 -0
- package/dist/src/cli/helpers.mjs +16 -0
- package/dist/src/columns/bigint.d.mts +19 -0
- package/dist/src/columns/bigint.mjs +32 -0
- package/dist/src/columns/bigserial.d.mts +24 -0
- package/dist/src/columns/bigserial.mjs +35 -0
- package/dist/src/columns/boolean.d.mts +19 -0
- package/dist/src/columns/boolean.mjs +31 -0
- package/dist/src/columns/bytea.d.mts +19 -0
- package/dist/src/columns/bytea.mjs +33 -0
- package/dist/src/columns/char.d.mts +32 -0
- package/dist/src/columns/char.mjs +44 -0
- package/dist/src/columns/cidr.d.mts +19 -0
- package/dist/src/columns/cidr.mjs +31 -0
- package/dist/src/columns/common.d.mts +233 -0
- package/dist/src/columns/common.mjs +276 -0
- package/dist/src/columns/date.d.mts +19 -0
- package/dist/src/columns/date.mjs +32 -0
- package/dist/src/columns/enum.d.mts +21 -0
- package/dist/src/columns/enum.mjs +35 -0
- package/dist/src/columns/inet.d.mts +19 -0
- package/dist/src/columns/inet.mjs +36 -0
- package/dist/src/columns/integer.d.mts +19 -0
- package/dist/src/columns/integer.mjs +32 -0
- package/dist/src/columns/json.d.mts +52 -0
- package/dist/src/columns/json.mjs +67 -0
- package/dist/src/columns/jsonb.d.mts +53 -0
- package/dist/src/columns/jsonb.mjs +68 -0
- package/dist/src/columns/macaddr.d.mts +19 -0
- package/dist/src/columns/macaddr.mjs +31 -0
- package/dist/src/columns/numeric.d.mts +42 -0
- package/dist/src/columns/numeric.mjs +57 -0
- package/dist/src/columns/postgis/geography/index.d.mts +18 -0
- package/dist/src/columns/postgis/geography/index.mjs +17 -0
- package/dist/src/columns/postgis/geography/linestring.d.mts +38 -0
- package/dist/src/columns/postgis/geography/linestring.mjs +70 -0
- package/dist/src/columns/postgis/geography/multilinestring.d.mts +39 -0
- package/dist/src/columns/postgis/geography/multilinestring.mjs +70 -0
- package/dist/src/columns/postgis/geography/multipoint.d.mts +38 -0
- package/dist/src/columns/postgis/geography/multipoint.mjs +70 -0
- package/dist/src/columns/postgis/geography/multipolygon.d.mts +40 -0
- package/dist/src/columns/postgis/geography/multipolygon.mjs +70 -0
- package/dist/src/columns/postgis/geography/point.d.mts +36 -0
- package/dist/src/columns/postgis/geography/point.mjs +69 -0
- package/dist/src/columns/postgis/geography/polygon.d.mts +39 -0
- package/dist/src/columns/postgis/geography/polygon.mjs +70 -0
- package/dist/src/columns/serial.d.mts +24 -0
- package/dist/src/columns/serial.mjs +35 -0
- package/dist/src/columns/smallint.d.mts +19 -0
- package/dist/src/columns/smallint.mjs +32 -0
- package/dist/src/columns/smallserial.d.mts +24 -0
- package/dist/src/columns/smallserial.mjs +35 -0
- package/dist/src/columns/text.d.mts +19 -0
- package/dist/src/columns/text.mjs +30 -0
- package/dist/src/columns/time.d.mts +44 -0
- package/dist/src/columns/time.mjs +47 -0
- package/dist/src/columns/timestamp.d.mts +44 -0
- package/dist/src/columns/timestamp.mjs +47 -0
- package/dist/src/columns/uuid.d.mts +33 -0
- package/dist/src/columns/uuid.mjs +44 -0
- package/dist/src/columns/varchar.d.mts +32 -0
- package/dist/src/columns/varchar.mjs +44 -0
- package/dist/src/connectors/bun.d.mts +18 -0
- package/dist/src/connectors/bun.mjs +97 -0
- package/dist/src/connectors/common.d.mts +148 -0
- package/dist/src/connectors/common.mjs +65 -0
- package/dist/src/connectors/pg.d.mts +18 -0
- package/dist/src/connectors/pg.mjs +103 -0
- package/dist/src/connectors/pglite.d.mts +19 -0
- package/dist/src/connectors/pglite.mjs +94 -0
- package/dist/src/connectors/postgres.d.mts +18 -0
- package/dist/src/connectors/postgres.mjs +93 -0
- package/dist/src/constraints/check.d.mts +88 -0
- package/dist/src/constraints/check.mjs +307 -0
- package/dist/src/constraints/primary-key.d.mts +28 -0
- package/dist/src/constraints/primary-key.mjs +36 -0
- package/dist/src/constraints/unique.d.mts +28 -0
- package/dist/src/constraints/unique.mjs +36 -0
- package/dist/src/db.d.mts +180 -0
- package/dist/src/db.mjs +191 -0
- package/dist/src/entity.mjs +23 -0
- package/dist/src/enumtype.d.mts +27 -0
- package/dist/src/enumtype.mjs +42 -0
- package/dist/src/filters/array.d.mts +97 -0
- package/dist/src/filters/array.mjs +150 -0
- package/dist/src/filters/custom.d.mts +12 -0
- package/dist/src/filters/custom.mjs +7 -0
- package/dist/src/filters/index.d.mts +155 -0
- package/dist/src/filters/index.mjs +318 -0
- package/dist/src/functions/index.d.mts +24 -0
- package/dist/src/functions/index.mjs +29 -0
- package/dist/src/index.d.mts +129 -0
- package/dist/src/index.mjs +78 -0
- package/dist/src/indexes.d.mts +31 -0
- package/dist/src/indexes.mjs +43 -0
- package/dist/src/migration/consts.d.mts +8 -0
- package/dist/src/migration/consts.mjs +8 -0
- package/dist/src/migration/ddl.d.mts +747 -0
- package/dist/src/migration/ddl.mjs +1084 -0
- package/dist/src/migration/index.d.mts +15 -0
- package/dist/src/migration/index.mjs +5 -0
- package/dist/src/migration/snapshot.d.mts +169 -0
- package/dist/src/migration/snapshot.mjs +123 -0
- package/dist/src/migration/statement.d.mts +89 -0
- package/dist/src/migration/statement.mjs +61 -0
- package/dist/src/models.d.mts +34 -0
- package/dist/src/models.mjs +27 -0
- package/dist/src/node_modules/.pnpm/chalk@5.6.2/node_modules/chalk/source/index.mjs +126 -0
- package/dist/src/node_modules/.pnpm/chalk@5.6.2/node_modules/chalk/source/utilities.mjs +29 -0
- package/dist/src/node_modules/.pnpm/chalk@5.6.2/node_modules/chalk/source/vendor/ansi-styles/index.mjs +165 -0
- package/dist/src/node_modules/.pnpm/chalk@5.6.2/node_modules/chalk/source/vendor/supports-color/index.mjs +92 -0
- package/dist/src/query-builders/aggregates.d.mts +20 -0
- package/dist/src/query-builders/aggregates.mjs +43 -0
- package/dist/src/query-builders/count.d.mts +19 -0
- package/dist/src/query-builders/count.mjs +36 -0
- package/dist/src/query-builders/delete.d.mts +19 -0
- package/dist/src/query-builders/delete.mjs +57 -0
- package/dist/src/query-builders/distinct.d.mts +19 -0
- package/dist/src/query-builders/distinct.mjs +42 -0
- package/dist/src/query-builders/exists.d.mts +19 -0
- package/dist/src/query-builders/exists.mjs +37 -0
- package/dist/src/query-builders/first.d.mts +17 -0
- package/dist/src/query-builders/first.mjs +46 -0
- package/dist/src/query-builders/insert-returning.d.mts +16 -0
- package/dist/src/query-builders/insert-returning.mjs +63 -0
- package/dist/src/query-builders/insert.d.mts +22 -0
- package/dist/src/query-builders/insert.mjs +93 -0
- package/dist/src/query-builders/orderby-clause.d.mts +14 -0
- package/dist/src/query-builders/orderby-clause.mjs +20 -0
- package/dist/src/query-builders/pre.d.mts +36 -0
- package/dist/src/query-builders/pre.mjs +60 -0
- package/dist/src/query-builders/query-promise.d.mts +14 -0
- package/dist/src/query-builders/query-promise.mjs +21 -0
- package/dist/src/query-builders/query.d.mts +14 -0
- package/dist/src/query-builders/query.mjs +17 -0
- package/dist/src/query-builders/raw.d.mts +14 -0
- package/dist/src/query-builders/raw.mjs +26 -0
- package/dist/src/query-builders/rq.d.mts +36 -0
- package/dist/src/query-builders/rq.mjs +231 -0
- package/dist/src/query-builders/select.d.mts +48 -0
- package/dist/src/query-builders/select.mjs +118 -0
- package/dist/src/query-builders/update.d.mts +24 -0
- package/dist/src/query-builders/update.mjs +99 -0
- package/dist/src/sequence.d.mts +48 -0
- package/dist/src/sequence.mjs +53 -0
- package/dist/src/sql.d.mts +15 -0
- package/dist/src/sql.mjs +36 -0
- package/dist/src/symbols.d.mts +4 -0
- package/dist/src/symbols.mjs +4 -0
- package/dist/src/table.d.mts +144 -0
- package/dist/src/table.mjs +134 -0
- package/dist/src/types.d.mts +4 -0
- package/dist/src/utils.mjs +10 -0
- package/dist/src/validators/zod.d.mts +23 -0
- package/dist/src/validators/zod.mjs +27 -0
- package/dist/src/wkx/binaryreader.mjs +56 -0
- package/dist/src/wkx/binarywriter.mjs +110 -0
- package/dist/src/wkx/geometry.mjs +101 -0
- package/dist/src/wkx/geometrycollection.mjs +113 -0
- package/dist/src/wkx/index.mjs +18 -0
- package/dist/src/wkx/linestring.mjs +124 -0
- package/dist/src/wkx/multilinestring.mjs +133 -0
- package/dist/src/wkx/multipoint.mjs +120 -0
- package/dist/src/wkx/multipolygon.mjs +155 -0
- package/dist/src/wkx/parser.mjs +183 -0
- package/dist/src/wkx/point.mjs +159 -0
- package/dist/src/wkx/polygon.mjs +189 -0
- package/dist/src/wkx/types.mjs +37 -0
- package/dist/src/wkx/wktparser.mjs +109 -0
- package/dist/src/wkx/zigzag.mjs +18 -0
- package/package.json +100 -0
|
@@ -0,0 +1,70 @@
|
|
|
1
|
+
import { Column } from "../../common.mjs";
|
|
2
|
+
import { Sql } from "../../../sql.mjs";
|
|
3
|
+
import { MultiPolygon } from "../../../wkx/multipolygon.mjs";
|
|
4
|
+
import "../../../wkx/index.mjs";
|
|
5
|
+
import * as z from "zod";
|
|
6
|
+
//#region src/columns/postgis/geography/multipolygon.ts
|
|
7
|
+
var MultiPolygonColumn = class extends Column {
|
|
8
|
+
static id = "Column.Geography.MultiPolygon";
|
|
9
|
+
#srid;
|
|
10
|
+
#as;
|
|
11
|
+
#hasZ;
|
|
12
|
+
#hasM;
|
|
13
|
+
constructor(config) {
|
|
14
|
+
super(config);
|
|
15
|
+
this.#srid = config.srid ?? 4326;
|
|
16
|
+
this.#as = config.format ?? "xy";
|
|
17
|
+
this.#hasZ = config.format ? config.format.includes("z") : false;
|
|
18
|
+
this.#hasM = config.format ? config.format.includes("m") : false;
|
|
19
|
+
}
|
|
20
|
+
get sqlTypeScalar() {
|
|
21
|
+
return `geography(MULTIPOLYGON, ${this.#srid})`;
|
|
22
|
+
}
|
|
23
|
+
get zodTypeScaler() {
|
|
24
|
+
const pointTuple = z.tuple(this.#as ? this.#as.split("").map(() => z.number()) : [z.number(), z.number()]);
|
|
25
|
+
return z.array(z.array(z.array(pointTuple)));
|
|
26
|
+
}
|
|
27
|
+
toDriverScalar(value) {
|
|
28
|
+
if (value === null) return null;
|
|
29
|
+
if (value instanceof Sql) return value.string;
|
|
30
|
+
const multiPolygon = MultiPolygon.parseGeoJSON({
|
|
31
|
+
type: "MultiPolygon",
|
|
32
|
+
coordinates: value
|
|
33
|
+
});
|
|
34
|
+
return `SRID=${this.#srid};${multiPolygon.toWkt()}`;
|
|
35
|
+
}
|
|
36
|
+
toSQLScalar(value) {
|
|
37
|
+
if (value === null) return "NULL";
|
|
38
|
+
if (value instanceof Sql) return value.string;
|
|
39
|
+
const multiPolygon = MultiPolygon.parseGeoJSON({
|
|
40
|
+
type: "MultiPolygon",
|
|
41
|
+
coordinates: value
|
|
42
|
+
});
|
|
43
|
+
return `'SRID=${this.#srid};${multiPolygon.toWkt()}'`;
|
|
44
|
+
}
|
|
45
|
+
fromDriverScalar(value) {
|
|
46
|
+
if (value === null) return value;
|
|
47
|
+
const buffer = Buffer.from(value, "hex");
|
|
48
|
+
return MultiPolygon.parse(buffer, {
|
|
49
|
+
srid: this.#srid,
|
|
50
|
+
hasZ: this.#hasZ,
|
|
51
|
+
hasM: this.#hasM
|
|
52
|
+
}).toGeoJSON().coordinates;
|
|
53
|
+
}
|
|
54
|
+
};
|
|
55
|
+
/**
|
|
56
|
+
* Creates a PostGIS `geography(MULTIPOLYGON)` column. Maps to an array of polygons.
|
|
57
|
+
*
|
|
58
|
+
* @example
|
|
59
|
+
* ```ts
|
|
60
|
+
* geography.multipolygon({ srid: 4326 }) // geography(MULTIPOLYGON, 4326)
|
|
61
|
+
* ```
|
|
62
|
+
*
|
|
63
|
+
* @param config.srid - Spatial reference ID (default: 4326)
|
|
64
|
+
* @param config.format - Coordinate format: `"xy"` (default: `"xy"`)
|
|
65
|
+
*/
|
|
66
|
+
function multipolygon(config) {
|
|
67
|
+
return new MultiPolygonColumn(config);
|
|
68
|
+
}
|
|
69
|
+
//#endregion
|
|
70
|
+
export { multipolygon };
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
import { Sql } from "../../../sql.mjs";
|
|
2
|
+
import { Column, ColumnConfig } from "../../common.mjs";
|
|
3
|
+
import * as z from "zod";
|
|
4
|
+
|
|
5
|
+
//#region src/columns/postgis/geography/point.d.ts
|
|
6
|
+
type As = "xy" | "xyz" | "xym" | "xyzm";
|
|
7
|
+
type PointConfig = ColumnConfig & {
|
|
8
|
+
srid?: number;
|
|
9
|
+
format?: "xy";
|
|
10
|
+
};
|
|
11
|
+
type GetValType<T extends As | undefined> = T extends "xy" ? SelfOrReadonly<[number, number]> : T extends "xyz" | "xym" ? SelfOrReadonly<[number, number, number]> : T extends "xyzm" ? SelfOrReadonly<[number, number, number, number]> : SelfOrReadonly<[number, number]>;
|
|
12
|
+
type GetZodType<T extends As | undefined> = T extends "xy" ? z.ZodTuple<[z.ZodNumber, z.ZodNumber], null> : T extends "xyz" | "xym" ? z.ZodTuple<[z.ZodNumber, z.ZodNumber, z.ZodNumber], null> : T extends "xyzm" ? z.ZodTuple<[z.ZodNumber, z.ZodNumber, z.ZodNumber, z.ZodNumber], null> : z.ZodTuple<[z.ZodNumber, z.ZodNumber], null>;
|
|
13
|
+
declare class PointColumn<TConfig extends PointConfig> extends Column<TConfig, GetValType<TConfig["format"]>> {
|
|
14
|
+
#private;
|
|
15
|
+
static readonly id = "Column.Geography.Point";
|
|
16
|
+
constructor(config: TConfig);
|
|
17
|
+
get sqlTypeScalar(): string;
|
|
18
|
+
get zodTypeScaler(): GetZodType<TConfig["format"]>;
|
|
19
|
+
toDriverScalar(value: GetValType<TConfig["format"]> | Sql | null): string | null;
|
|
20
|
+
toSQLScalar(value: GetValType<TConfig["format"]> | Sql | null): string;
|
|
21
|
+
fromDriverScalar(value: string | null): GetValType<TConfig["format"]> | null;
|
|
22
|
+
}
|
|
23
|
+
/**
|
|
24
|
+
* Creates a PostGIS `geography(POINT)` column. Maps to `[lon, lat]` tuple.
|
|
25
|
+
*
|
|
26
|
+
* @example
|
|
27
|
+
* ```ts
|
|
28
|
+
* geography.point({ srid: 4326 }) // geography(POINT, 4326)
|
|
29
|
+
* ```
|
|
30
|
+
*
|
|
31
|
+
* @param config.srid - Spatial reference ID (default: 4326)
|
|
32
|
+
* @param config.format - Coordinate format: `"xy"` (default: `"xy"`)
|
|
33
|
+
*/
|
|
34
|
+
declare function point<TConfig extends PointConfig>(config: TConfig): PointColumn<TConfig>;
|
|
35
|
+
//#endregion
|
|
36
|
+
export { point };
|
|
@@ -0,0 +1,69 @@
|
|
|
1
|
+
import { Column } from "../../common.mjs";
|
|
2
|
+
import { Sql } from "../../../sql.mjs";
|
|
3
|
+
import { Point } from "../../../wkx/point.mjs";
|
|
4
|
+
import "../../../wkx/index.mjs";
|
|
5
|
+
import * as z from "zod";
|
|
6
|
+
//#region src/columns/postgis/geography/point.ts
|
|
7
|
+
var PointColumn = class extends Column {
|
|
8
|
+
static id = "Column.Geography.Point";
|
|
9
|
+
#srid;
|
|
10
|
+
#format;
|
|
11
|
+
#hasZ;
|
|
12
|
+
#hasM;
|
|
13
|
+
constructor(config) {
|
|
14
|
+
super(config);
|
|
15
|
+
this.#srid = config.srid ?? 4326;
|
|
16
|
+
this.#format = config.format ?? "xy";
|
|
17
|
+
this.#hasZ = config.format ? config.format.includes("z") : false;
|
|
18
|
+
this.#hasM = config.format ? config.format.includes("m") : false;
|
|
19
|
+
}
|
|
20
|
+
get sqlTypeScalar() {
|
|
21
|
+
return `geography(POINT, ${this.#srid})`;
|
|
22
|
+
}
|
|
23
|
+
get zodTypeScaler() {
|
|
24
|
+
return z.tuple(this.#format ? this.#format.split("").map(() => z.number()) : [z.number(), z.number()]);
|
|
25
|
+
}
|
|
26
|
+
toDriverScalar(value) {
|
|
27
|
+
if (value === null) return null;
|
|
28
|
+
if (value instanceof Sql) return value.string;
|
|
29
|
+
const point = Point.parseGeoJSON({
|
|
30
|
+
type: "Point",
|
|
31
|
+
coordinates: value
|
|
32
|
+
});
|
|
33
|
+
return `SRID=${this.#srid};${point.toWkt()}`;
|
|
34
|
+
}
|
|
35
|
+
toSQLScalar(value) {
|
|
36
|
+
if (value === null) return "NULL";
|
|
37
|
+
if (value instanceof Sql) return value.string;
|
|
38
|
+
const point = Point.parseGeoJSON({
|
|
39
|
+
type: "Point",
|
|
40
|
+
coordinates: value
|
|
41
|
+
});
|
|
42
|
+
return `'SRID=${this.#srid};${point.toWkt()}'`;
|
|
43
|
+
}
|
|
44
|
+
fromDriverScalar(value) {
|
|
45
|
+
if (value === null) return value;
|
|
46
|
+
const buffer = Buffer.from(value, "hex");
|
|
47
|
+
return Point.parse(buffer, {
|
|
48
|
+
srid: this.#srid,
|
|
49
|
+
hasZ: this.#hasZ,
|
|
50
|
+
hasM: this.#hasM
|
|
51
|
+
}).toGeoJSON().coordinates;
|
|
52
|
+
}
|
|
53
|
+
};
|
|
54
|
+
/**
|
|
55
|
+
* Creates a PostGIS `geography(POINT)` column. Maps to `[lon, lat]` tuple.
|
|
56
|
+
*
|
|
57
|
+
* @example
|
|
58
|
+
* ```ts
|
|
59
|
+
* geography.point({ srid: 4326 }) // geography(POINT, 4326)
|
|
60
|
+
* ```
|
|
61
|
+
*
|
|
62
|
+
* @param config.srid - Spatial reference ID (default: 4326)
|
|
63
|
+
* @param config.format - Coordinate format: `"xy"` (default: `"xy"`)
|
|
64
|
+
*/
|
|
65
|
+
function point(config) {
|
|
66
|
+
return new PointColumn(config);
|
|
67
|
+
}
|
|
68
|
+
//#endregion
|
|
69
|
+
export { point };
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
import { Sql } from "../../../sql.mjs";
|
|
2
|
+
import { Column, ColumnConfig } from "../../common.mjs";
|
|
3
|
+
import * as z from "zod";
|
|
4
|
+
|
|
5
|
+
//#region src/columns/postgis/geography/polygon.d.ts
|
|
6
|
+
type As = "xy" | "xyz" | "xym" | "xyzm";
|
|
7
|
+
type PolygonConfig = ColumnConfig & {
|
|
8
|
+
srid?: number;
|
|
9
|
+
format?: "xy";
|
|
10
|
+
};
|
|
11
|
+
type GetPointType<T extends As | undefined> = T extends "xy" ? SelfOrReadonly<[number, number]> : T extends "xyz" | "xym" ? SelfOrReadonly<[number, number, number]> : T extends "xyzm" ? SelfOrReadonly<[number, number, number, number]> : SelfOrReadonly<[number, number]>;
|
|
12
|
+
type GetRingType<T extends As | undefined> = SelfOrReadonly<GetPointType<T>[]>;
|
|
13
|
+
type GetValType<T extends As | undefined> = SelfOrReadonly<GetRingType<T>[]>;
|
|
14
|
+
type GetPointZodType<T extends As | undefined> = T extends "xy" ? z.ZodTuple<[z.ZodNumber, z.ZodNumber], null> : T extends "xyz" | "xym" ? z.ZodTuple<[z.ZodNumber, z.ZodNumber, z.ZodNumber], null> : T extends "xyzm" ? z.ZodTuple<[z.ZodNumber, z.ZodNumber, z.ZodNumber, z.ZodNumber], null> : z.ZodTuple<[z.ZodNumber, z.ZodNumber], null>;
|
|
15
|
+
type GetZodType<T extends As | undefined> = z.ZodArray<z.ZodArray<GetPointZodType<T>>>;
|
|
16
|
+
declare class PolygonColumn<TConfig extends PolygonConfig> extends Column<TConfig, GetValType<TConfig["format"]>> {
|
|
17
|
+
#private;
|
|
18
|
+
static readonly id = "Column.Geography.Polygon";
|
|
19
|
+
constructor(config: TConfig);
|
|
20
|
+
get sqlTypeScalar(): string;
|
|
21
|
+
get zodTypeScaler(): GetZodType<TConfig["format"]>;
|
|
22
|
+
toDriverScalar(value: GetValType<TConfig["format"]> | Sql | null): string | null;
|
|
23
|
+
toSQLScalar(value: GetValType<TConfig["format"]> | Sql | null): string;
|
|
24
|
+
fromDriverScalar(value: string | null): GetValType<TConfig["format"]> | null;
|
|
25
|
+
}
|
|
26
|
+
/**
|
|
27
|
+
* Creates a PostGIS `geography(POLYGON)` column. Maps to an array of rings (arrays of `[lon, lat]` tuples).
|
|
28
|
+
*
|
|
29
|
+
* @example
|
|
30
|
+
* ```ts
|
|
31
|
+
* geography.polygon({ srid: 4326 }) // geography(POLYGON, 4326)
|
|
32
|
+
* ```
|
|
33
|
+
*
|
|
34
|
+
* @param config.srid - Spatial reference ID (default: 4326)
|
|
35
|
+
* @param config.format - Coordinate format: `"xy"` (default: `"xy"`)
|
|
36
|
+
*/
|
|
37
|
+
declare function polygon<TConfig extends PolygonConfig>(config: TConfig): PolygonColumn<TConfig>;
|
|
38
|
+
//#endregion
|
|
39
|
+
export { polygon };
|
|
@@ -0,0 +1,70 @@
|
|
|
1
|
+
import { Column } from "../../common.mjs";
|
|
2
|
+
import { Sql } from "../../../sql.mjs";
|
|
3
|
+
import { Polygon } from "../../../wkx/polygon.mjs";
|
|
4
|
+
import "../../../wkx/index.mjs";
|
|
5
|
+
import * as z from "zod";
|
|
6
|
+
//#region src/columns/postgis/geography/polygon.ts
|
|
7
|
+
var PolygonColumn = class extends Column {
|
|
8
|
+
static id = "Column.Geography.Polygon";
|
|
9
|
+
#srid;
|
|
10
|
+
#as;
|
|
11
|
+
#hasZ;
|
|
12
|
+
#hasM;
|
|
13
|
+
constructor(config) {
|
|
14
|
+
super(config);
|
|
15
|
+
this.#srid = config.srid ?? 4326;
|
|
16
|
+
this.#as = config.format ?? "xy";
|
|
17
|
+
this.#hasZ = config.format ? config.format.includes("z") : false;
|
|
18
|
+
this.#hasM = config.format ? config.format.includes("m") : false;
|
|
19
|
+
}
|
|
20
|
+
get sqlTypeScalar() {
|
|
21
|
+
return `geography(POLYGON, ${this.#srid})`;
|
|
22
|
+
}
|
|
23
|
+
get zodTypeScaler() {
|
|
24
|
+
const pointTuple = z.tuple(this.#as ? this.#as.split("").map(() => z.number()) : [z.number(), z.number()]);
|
|
25
|
+
return z.array(z.array(pointTuple));
|
|
26
|
+
}
|
|
27
|
+
toDriverScalar(value) {
|
|
28
|
+
if (value === null) return null;
|
|
29
|
+
if (value instanceof Sql) return value.string;
|
|
30
|
+
const polygon = Polygon.parseGeoJSON({
|
|
31
|
+
type: "Polygon",
|
|
32
|
+
coordinates: value
|
|
33
|
+
});
|
|
34
|
+
return `SRID=${this.#srid};${polygon.toWkt()}`;
|
|
35
|
+
}
|
|
36
|
+
toSQLScalar(value) {
|
|
37
|
+
if (value === null) return "NULL";
|
|
38
|
+
if (value instanceof Sql) return value.string;
|
|
39
|
+
const polygon = Polygon.parseGeoJSON({
|
|
40
|
+
type: "Polygon",
|
|
41
|
+
coordinates: value
|
|
42
|
+
});
|
|
43
|
+
return `'SRID=${this.#srid};${polygon.toWkt()}'`;
|
|
44
|
+
}
|
|
45
|
+
fromDriverScalar(value) {
|
|
46
|
+
if (value === null) return value;
|
|
47
|
+
const buffer = Buffer.from(value, "hex");
|
|
48
|
+
return Polygon.parse(buffer, {
|
|
49
|
+
srid: this.#srid,
|
|
50
|
+
hasZ: this.#hasZ,
|
|
51
|
+
hasM: this.#hasM
|
|
52
|
+
}).toGeoJSON().coordinates;
|
|
53
|
+
}
|
|
54
|
+
};
|
|
55
|
+
/**
|
|
56
|
+
* Creates a PostGIS `geography(POLYGON)` column. Maps to an array of rings (arrays of `[lon, lat]` tuples).
|
|
57
|
+
*
|
|
58
|
+
* @example
|
|
59
|
+
* ```ts
|
|
60
|
+
* geography.polygon({ srid: 4326 }) // geography(POLYGON, 4326)
|
|
61
|
+
* ```
|
|
62
|
+
*
|
|
63
|
+
* @param config.srid - Spatial reference ID (default: 4326)
|
|
64
|
+
* @param config.format - Coordinate format: `"xy"` (default: `"xy"`)
|
|
65
|
+
*/
|
|
66
|
+
function polygon(config) {
|
|
67
|
+
return new PolygonColumn(config);
|
|
68
|
+
}
|
|
69
|
+
//#endregion
|
|
70
|
+
export { polygon };
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import { Sql } from "../sql.mjs";
|
|
2
|
+
import { Column, ColumnConfig } from "./common.mjs";
|
|
3
|
+
import * as z from "zod";
|
|
4
|
+
|
|
5
|
+
//#region src/columns/serial.d.ts
|
|
6
|
+
type SerialValType = number;
|
|
7
|
+
type SerialConfig = Pick<ColumnConfig, "primaryKey" | "unique">;
|
|
8
|
+
type SerialInternalConfig<TConfig extends SerialConfig> = TConfig & {
|
|
9
|
+
generated: "BY DEFAULT";
|
|
10
|
+
notNull: true;
|
|
11
|
+
};
|
|
12
|
+
declare class SerialColumn<TConfig extends SerialConfig> extends Column<SerialInternalConfig<TConfig>, SerialValType> {
|
|
13
|
+
static readonly id = "Column.Serial";
|
|
14
|
+
constructor(config: TConfig);
|
|
15
|
+
get sqlTypeScalar(): string;
|
|
16
|
+
get zodTypeScaler(): z.ZodCoercedNumber<unknown>;
|
|
17
|
+
toDriverScalar(value: SerialValType | Sql | null): string | number | null;
|
|
18
|
+
toSQLScalar(value: number | Sql | null): string;
|
|
19
|
+
fromDriverScalar(value: number | string | null): SerialValType | null;
|
|
20
|
+
}
|
|
21
|
+
/** Creates a `serial` column. Auto-incrementing 32-bit integer, implicitly `NOT NULL`. Maps to `number`. */
|
|
22
|
+
declare function serial<TConfig extends SerialConfig>(config: TConfig): SerialColumn<TConfig>;
|
|
23
|
+
//#endregion
|
|
24
|
+
export { serial };
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
import { Column } from "./common.mjs";
|
|
2
|
+
import { Sql } from "../sql.mjs";
|
|
3
|
+
import * as z from "zod";
|
|
4
|
+
//#region src/columns/serial.ts
|
|
5
|
+
var SerialColumn = class extends Column {
|
|
6
|
+
static id = "Column.Serial";
|
|
7
|
+
constructor(config) {
|
|
8
|
+
super(config);
|
|
9
|
+
}
|
|
10
|
+
get sqlTypeScalar() {
|
|
11
|
+
return "serial";
|
|
12
|
+
}
|
|
13
|
+
get zodTypeScaler() {
|
|
14
|
+
return z.coerce.number();
|
|
15
|
+
}
|
|
16
|
+
toDriverScalar(value) {
|
|
17
|
+
if (value === null) return null;
|
|
18
|
+
return value instanceof Sql ? value.string : value;
|
|
19
|
+
}
|
|
20
|
+
toSQLScalar(value) {
|
|
21
|
+
if (value === null) return "NULL";
|
|
22
|
+
if (value instanceof Sql) return value.string;
|
|
23
|
+
return value.toString();
|
|
24
|
+
}
|
|
25
|
+
fromDriverScalar(value) {
|
|
26
|
+
if (value === null) return null;
|
|
27
|
+
return typeof value === "string" ? parseInt(value, 10) : value;
|
|
28
|
+
}
|
|
29
|
+
};
|
|
30
|
+
/** Creates a `serial` column. Auto-incrementing 32-bit integer, implicitly `NOT NULL`. Maps to `number`. */
|
|
31
|
+
function serial(config) {
|
|
32
|
+
return new SerialColumn(config);
|
|
33
|
+
}
|
|
34
|
+
//#endregion
|
|
35
|
+
export { serial };
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import { Sql } from "../sql.mjs";
|
|
2
|
+
import { Column, ColumnConfig } from "./common.mjs";
|
|
3
|
+
import * as z from "zod";
|
|
4
|
+
|
|
5
|
+
//#region src/columns/smallint.d.ts
|
|
6
|
+
type SmallintValType = number;
|
|
7
|
+
type SmallintConfig = ColumnConfig;
|
|
8
|
+
declare class SmallintColumn<TConfig extends SmallintConfig> extends Column<TConfig, SmallintValType> {
|
|
9
|
+
static readonly id = "Column.Smallint";
|
|
10
|
+
get sqlTypeScalar(): string;
|
|
11
|
+
get zodTypeScaler(): z.ZodCoercedNumber<unknown>;
|
|
12
|
+
toDriverScalar(value: SmallintValType | Sql | null): string | number | null;
|
|
13
|
+
toSQLScalar(value: number | Sql | null): string;
|
|
14
|
+
fromDriverScalar(value: number | string | null): SmallintValType | null;
|
|
15
|
+
}
|
|
16
|
+
/** Creates a `smallint` column. PostgreSQL 16-bit signed integer, maps to `number`. */
|
|
17
|
+
declare function smallint<TConfig extends SmallintConfig>(config: TConfig): SmallintColumn<TConfig>;
|
|
18
|
+
//#endregion
|
|
19
|
+
export { smallint };
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
import { Column } from "./common.mjs";
|
|
2
|
+
import { Sql } from "../sql.mjs";
|
|
3
|
+
import * as z from "zod";
|
|
4
|
+
//#region src/columns/smallint.ts
|
|
5
|
+
var SmallintColumn = class extends Column {
|
|
6
|
+
static id = "Column.Smallint";
|
|
7
|
+
get sqlTypeScalar() {
|
|
8
|
+
return "smallint";
|
|
9
|
+
}
|
|
10
|
+
get zodTypeScaler() {
|
|
11
|
+
return z.coerce.number();
|
|
12
|
+
}
|
|
13
|
+
toDriverScalar(value) {
|
|
14
|
+
if (value === null) return null;
|
|
15
|
+
return value instanceof Sql ? value.string : value;
|
|
16
|
+
}
|
|
17
|
+
toSQLScalar(value) {
|
|
18
|
+
if (value === null) return "NULL";
|
|
19
|
+
if (value instanceof Sql) return value.string;
|
|
20
|
+
return value.toString();
|
|
21
|
+
}
|
|
22
|
+
fromDriverScalar(value) {
|
|
23
|
+
if (value === null) return null;
|
|
24
|
+
return typeof value === "string" ? parseInt(value, 10) : value;
|
|
25
|
+
}
|
|
26
|
+
};
|
|
27
|
+
/** Creates a `smallint` column. PostgreSQL 16-bit signed integer, maps to `number`. */
|
|
28
|
+
function smallint(config) {
|
|
29
|
+
return new SmallintColumn(config);
|
|
30
|
+
}
|
|
31
|
+
//#endregion
|
|
32
|
+
export { smallint };
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import { Sql } from "../sql.mjs";
|
|
2
|
+
import { Column, ColumnConfig } from "./common.mjs";
|
|
3
|
+
import * as z from "zod";
|
|
4
|
+
|
|
5
|
+
//#region src/columns/smallserial.d.ts
|
|
6
|
+
type SmallserialValType = number;
|
|
7
|
+
type SmallserialConfig = Pick<ColumnConfig, "primaryKey" | "unique">;
|
|
8
|
+
type SmallserialInternalConfig<TConfig extends SmallserialConfig> = TConfig & {
|
|
9
|
+
generated: "BY DEFAULT";
|
|
10
|
+
notNull: true;
|
|
11
|
+
};
|
|
12
|
+
declare class SmallserialColumn<TConfig extends SmallserialConfig> extends Column<SmallserialInternalConfig<TConfig>, SmallserialValType> {
|
|
13
|
+
static readonly id = "Column.Smallserial";
|
|
14
|
+
constructor(config: TConfig);
|
|
15
|
+
get sqlTypeScalar(): string;
|
|
16
|
+
get zodTypeScaler(): z.ZodCoercedNumber<unknown>;
|
|
17
|
+
toDriverScalar(value: SmallserialValType | Sql | null): string | number | null;
|
|
18
|
+
toSQLScalar(value: number | Sql | null): string;
|
|
19
|
+
fromDriverScalar(value: number | string | null): SmallserialValType | null;
|
|
20
|
+
}
|
|
21
|
+
/** Creates a `smallserial` column. Auto-incrementing 16-bit integer, implicitly `NOT NULL`. Maps to `number`. */
|
|
22
|
+
declare function smallserial<TConfig extends SmallserialConfig>(config: TConfig): SmallserialColumn<TConfig>;
|
|
23
|
+
//#endregion
|
|
24
|
+
export { smallserial };
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
import { Column } from "./common.mjs";
|
|
2
|
+
import { Sql } from "../sql.mjs";
|
|
3
|
+
import * as z from "zod";
|
|
4
|
+
//#region src/columns/smallserial.ts
|
|
5
|
+
var SmallserialColumn = class extends Column {
|
|
6
|
+
static id = "Column.Smallserial";
|
|
7
|
+
constructor(config) {
|
|
8
|
+
super(config);
|
|
9
|
+
}
|
|
10
|
+
get sqlTypeScalar() {
|
|
11
|
+
return "smallserial";
|
|
12
|
+
}
|
|
13
|
+
get zodTypeScaler() {
|
|
14
|
+
return z.coerce.number();
|
|
15
|
+
}
|
|
16
|
+
toDriverScalar(value) {
|
|
17
|
+
if (value === null) return null;
|
|
18
|
+
return value instanceof Sql ? value.string : value;
|
|
19
|
+
}
|
|
20
|
+
toSQLScalar(value) {
|
|
21
|
+
if (value === null) return "NULL";
|
|
22
|
+
if (value instanceof Sql) return value.string;
|
|
23
|
+
return value.toString();
|
|
24
|
+
}
|
|
25
|
+
fromDriverScalar(value) {
|
|
26
|
+
if (value === null) return null;
|
|
27
|
+
return typeof value === "string" ? parseInt(value, 10) : value;
|
|
28
|
+
}
|
|
29
|
+
};
|
|
30
|
+
/** Creates a `smallserial` column. Auto-incrementing 16-bit integer, implicitly `NOT NULL`. Maps to `number`. */
|
|
31
|
+
function smallserial(config) {
|
|
32
|
+
return new SmallserialColumn(config);
|
|
33
|
+
}
|
|
34
|
+
//#endregion
|
|
35
|
+
export { smallserial };
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import { Sql } from "../sql.mjs";
|
|
2
|
+
import { Column, ColumnConfig } from "./common.mjs";
|
|
3
|
+
import * as z from "zod";
|
|
4
|
+
|
|
5
|
+
//#region src/columns/text.d.ts
|
|
6
|
+
type TextValType = string;
|
|
7
|
+
type TextConfig = ColumnConfig;
|
|
8
|
+
declare class TextColumn<TConfig extends TextConfig> extends Column<TConfig, TextValType> {
|
|
9
|
+
static readonly id = "Column.Text";
|
|
10
|
+
get sqlTypeScalar(): string;
|
|
11
|
+
get zodTypeScaler(): z.ZodString;
|
|
12
|
+
toDriverScalar(value: TextValType | Sql | null): string | null;
|
|
13
|
+
toSQLScalar(value: string | Sql | null): string;
|
|
14
|
+
fromDriverScalar(value: string | null): TextValType | null;
|
|
15
|
+
}
|
|
16
|
+
/** Creates a `text` column. PostgreSQL variable-length string with no length limit, maps to `string`. */
|
|
17
|
+
declare function text<TConfig extends TextConfig>(config: TConfig): TextColumn<TConfig>;
|
|
18
|
+
//#endregion
|
|
19
|
+
export { text };
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
import { Column } from "./common.mjs";
|
|
2
|
+
import { Sql } from "../sql.mjs";
|
|
3
|
+
import * as z from "zod";
|
|
4
|
+
//#region src/columns/text.ts
|
|
5
|
+
var TextColumn = class extends Column {
|
|
6
|
+
static id = "Column.Text";
|
|
7
|
+
get sqlTypeScalar() {
|
|
8
|
+
return "text";
|
|
9
|
+
}
|
|
10
|
+
get zodTypeScaler() {
|
|
11
|
+
return z.string();
|
|
12
|
+
}
|
|
13
|
+
toDriverScalar(value) {
|
|
14
|
+
if (value === null) return null;
|
|
15
|
+
return value instanceof Sql ? value.string : value;
|
|
16
|
+
}
|
|
17
|
+
toSQLScalar(value) {
|
|
18
|
+
if (value === null) return "NULL";
|
|
19
|
+
return value instanceof Sql ? value.string : `'${value.replace(/'/g, "''")}'`;
|
|
20
|
+
}
|
|
21
|
+
fromDriverScalar(value) {
|
|
22
|
+
return value;
|
|
23
|
+
}
|
|
24
|
+
};
|
|
25
|
+
/** Creates a `text` column. PostgreSQL variable-length string with no length limit, maps to `string`. */
|
|
26
|
+
function text(config) {
|
|
27
|
+
return new TextColumn(config);
|
|
28
|
+
}
|
|
29
|
+
//#endregion
|
|
30
|
+
export { text };
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
import { Sql } from "../sql.mjs";
|
|
2
|
+
import { Column, ColumnConfig } from "./common.mjs";
|
|
3
|
+
import * as z from "zod";
|
|
4
|
+
|
|
5
|
+
//#region src/columns/time.d.ts
|
|
6
|
+
type TimeValType = string;
|
|
7
|
+
type TimeConfig = ColumnConfig & {
|
|
8
|
+
/**
|
|
9
|
+
* Fractional seconds precision (0-6).
|
|
10
|
+
* When specified, uses `time(precision)` syntax.
|
|
11
|
+
*/
|
|
12
|
+
precision?: 0 | 1 | 2 | 3 | 4 | 5 | 6;
|
|
13
|
+
/**
|
|
14
|
+
* Include timezone information in the time value.
|
|
15
|
+
* When true, uses `time with time zone`.
|
|
16
|
+
* When false, uses `time`.
|
|
17
|
+
* @default false
|
|
18
|
+
*/
|
|
19
|
+
withTimezone?: boolean;
|
|
20
|
+
};
|
|
21
|
+
declare class TimeColumn<TConfig extends TimeConfig> extends Column<TConfig, TimeValType> {
|
|
22
|
+
#private;
|
|
23
|
+
static readonly id = "Column.Time";
|
|
24
|
+
constructor(config: TConfig);
|
|
25
|
+
get sqlTypeScalar(): string;
|
|
26
|
+
get zodTypeScaler(): z.ZodISOTime;
|
|
27
|
+
toDriverScalar(value: TimeValType | Sql | null): string | null;
|
|
28
|
+
toSQLScalar(value: string | Sql | null): string;
|
|
29
|
+
fromDriverScalar(value: string | null): TimeValType | null;
|
|
30
|
+
}
|
|
31
|
+
/**
|
|
32
|
+
* Creates a `time` column. Time of day without date, maps to `string`.
|
|
33
|
+
*
|
|
34
|
+
* @example
|
|
35
|
+
* ```ts
|
|
36
|
+
* time({ precision: 3, withTimezone: true, notNull }) // time(3) with time zone NOT NULL
|
|
37
|
+
* ```
|
|
38
|
+
*
|
|
39
|
+
* @param config.withTimezone - Include timezone info (default: `false`)
|
|
40
|
+
* @param config.precision - Fractional seconds precision (0–6)
|
|
41
|
+
*/
|
|
42
|
+
declare function time<TConfig extends TimeConfig>(config: TConfig): TimeColumn<TConfig>;
|
|
43
|
+
//#endregion
|
|
44
|
+
export { time };
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
import { Column } from "./common.mjs";
|
|
2
|
+
import { Sql } from "../sql.mjs";
|
|
3
|
+
import * as z from "zod";
|
|
4
|
+
//#region src/columns/time.ts
|
|
5
|
+
var TimeColumn = class extends Column {
|
|
6
|
+
static id = "Column.Time";
|
|
7
|
+
#withTimezone;
|
|
8
|
+
#precision;
|
|
9
|
+
constructor(config) {
|
|
10
|
+
super(config);
|
|
11
|
+
this.#withTimezone = config.withTimezone ?? false;
|
|
12
|
+
this.#precision = config.precision;
|
|
13
|
+
}
|
|
14
|
+
get sqlTypeScalar() {
|
|
15
|
+
return `time${this.#precision !== void 0 ? `(${this.#precision})` : ""}${this.#withTimezone ? " with time zone" : ""}`;
|
|
16
|
+
}
|
|
17
|
+
get zodTypeScaler() {
|
|
18
|
+
return z.iso.time({ precision: this.#precision });
|
|
19
|
+
}
|
|
20
|
+
toDriverScalar(value) {
|
|
21
|
+
if (value === null) return null;
|
|
22
|
+
return value instanceof Sql ? value.string : value;
|
|
23
|
+
}
|
|
24
|
+
toSQLScalar(value) {
|
|
25
|
+
if (value === null) return "NULL";
|
|
26
|
+
return value instanceof Sql ? value.string : `'${value.replace(/'/g, "''")}'`;
|
|
27
|
+
}
|
|
28
|
+
fromDriverScalar(value) {
|
|
29
|
+
return value;
|
|
30
|
+
}
|
|
31
|
+
};
|
|
32
|
+
/**
|
|
33
|
+
* Creates a `time` column. Time of day without date, maps to `string`.
|
|
34
|
+
*
|
|
35
|
+
* @example
|
|
36
|
+
* ```ts
|
|
37
|
+
* time({ precision: 3, withTimezone: true, notNull }) // time(3) with time zone NOT NULL
|
|
38
|
+
* ```
|
|
39
|
+
*
|
|
40
|
+
* @param config.withTimezone - Include timezone info (default: `false`)
|
|
41
|
+
* @param config.precision - Fractional seconds precision (0–6)
|
|
42
|
+
*/
|
|
43
|
+
function time(config) {
|
|
44
|
+
return new TimeColumn(config);
|
|
45
|
+
}
|
|
46
|
+
//#endregion
|
|
47
|
+
export { time };
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
import { Sql } from "../sql.mjs";
|
|
2
|
+
import { Column, ColumnConfig } from "./common.mjs";
|
|
3
|
+
import * as z from "zod";
|
|
4
|
+
|
|
5
|
+
//#region src/columns/timestamp.d.ts
|
|
6
|
+
type TimestampValType = Date;
|
|
7
|
+
type TimestampConfig = ColumnConfig & {
|
|
8
|
+
/**
|
|
9
|
+
* Fractional seconds precision (0-6).
|
|
10
|
+
* When specified, uses `timestamp(precision)` syntax.
|
|
11
|
+
*/
|
|
12
|
+
precision?: 0 | 1 | 2 | 3 | 4 | 5 | 6;
|
|
13
|
+
/**
|
|
14
|
+
* Include timezone information in the timestamp.
|
|
15
|
+
* When true, uses `timestamp with time zone` (recommended for UTC round-trips).
|
|
16
|
+
* When false, uses `timestamp` (recommended for local round-trips).
|
|
17
|
+
* @default true
|
|
18
|
+
*/
|
|
19
|
+
withTimezone?: boolean;
|
|
20
|
+
};
|
|
21
|
+
declare class TimestampColumn<TConfig extends TimestampConfig> extends Column<TConfig, TimestampValType> {
|
|
22
|
+
#private;
|
|
23
|
+
static readonly id = "Column.Timestamp";
|
|
24
|
+
constructor(config: TConfig);
|
|
25
|
+
get sqlTypeScalar(): string;
|
|
26
|
+
get zodTypeScaler(): z.ZodISODateTime;
|
|
27
|
+
toDriverScalar(value: TimestampValType | Sql | null): string | null;
|
|
28
|
+
toSQLScalar(value: TimestampValType | Sql | null): string;
|
|
29
|
+
fromDriverScalar(value: Date | null): TimestampValType | null;
|
|
30
|
+
}
|
|
31
|
+
/**
|
|
32
|
+
* Creates a `timestamp` column. Date and time, maps to `Date`.
|
|
33
|
+
*
|
|
34
|
+
* @example
|
|
35
|
+
* ```ts
|
|
36
|
+
* timestamp({ withTimezone: true, precision: 3, notNull }) // timestamp(3) with time zone NOT NULL
|
|
37
|
+
* ```
|
|
38
|
+
*
|
|
39
|
+
* @param config.withTimezone - Include timezone info (default: `true`)
|
|
40
|
+
* @param config.precision - Fractional seconds precision (0–6)
|
|
41
|
+
*/
|
|
42
|
+
declare function timestamp<TConfig extends TimestampConfig>(config: TConfig): TimestampColumn<TConfig>;
|
|
43
|
+
//#endregion
|
|
44
|
+
export { TimestampColumn, timestamp };
|