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,68 @@
|
|
|
1
|
+
import { Column } from "./common.mjs";
|
|
2
|
+
import { Sql } from "../sql.mjs";
|
|
3
|
+
import * as z from "zod";
|
|
4
|
+
//#region src/columns/jsonb.ts
|
|
5
|
+
/**
|
|
6
|
+
* PostgreSQL JSONB column type.
|
|
7
|
+
* Stores JSON data in a decomposed binary format for efficient processing.
|
|
8
|
+
*
|
|
9
|
+
* Key differences from JSON:
|
|
10
|
+
* - Does not preserve whitespace or key ordering
|
|
11
|
+
* - Supports GIN indexing for fast path queries
|
|
12
|
+
* - Slightly slower to insert (parsing overhead)
|
|
13
|
+
* - Faster to query (no reparsing needed)
|
|
14
|
+
* - Supports containment and existence operators (@>, ?, ?|, ?&)
|
|
15
|
+
*
|
|
16
|
+
* Use $type<T>() to specify a TypeScript type for the column value.
|
|
17
|
+
*
|
|
18
|
+
* @example
|
|
19
|
+
* ```ts
|
|
20
|
+
* // Basic JSONB column
|
|
21
|
+
* const table = table('users', {
|
|
22
|
+
* metadata: jsonb({}),
|
|
23
|
+
* });
|
|
24
|
+
*
|
|
25
|
+
* // Typed JSONB column
|
|
26
|
+
* interface UserSettings {
|
|
27
|
+
* theme: 'light' | 'dark';
|
|
28
|
+
* notifications: boolean;
|
|
29
|
+
* }
|
|
30
|
+
* const table = table('users', {
|
|
31
|
+
* settings: jsonb({}).$type<UserSettings>(),
|
|
32
|
+
* });
|
|
33
|
+
* ```
|
|
34
|
+
*/
|
|
35
|
+
var JsonbColumn = class extends Column {
|
|
36
|
+
static id = "Column.Jsonb";
|
|
37
|
+
get sqlTypeScalar() {
|
|
38
|
+
return "jsonb";
|
|
39
|
+
}
|
|
40
|
+
get zodTypeScaler() {
|
|
41
|
+
return z.unknown();
|
|
42
|
+
}
|
|
43
|
+
toDriverScalar(value) {
|
|
44
|
+
if (value === null) return null;
|
|
45
|
+
if (value instanceof Sql) return value.string;
|
|
46
|
+
return JSON.stringify(value);
|
|
47
|
+
}
|
|
48
|
+
toSQLScalar(value) {
|
|
49
|
+
if (value === null) return "NULL";
|
|
50
|
+
if (value instanceof Sql) return value.string;
|
|
51
|
+
return `'${JSON.stringify(value).replace(/'/g, "''")}'::jsonb`;
|
|
52
|
+
}
|
|
53
|
+
fromDriverScalar(value) {
|
|
54
|
+
if (value === null) return null;
|
|
55
|
+
if (typeof value === "string") try {
|
|
56
|
+
return JSON.parse(value);
|
|
57
|
+
} catch {
|
|
58
|
+
return value;
|
|
59
|
+
}
|
|
60
|
+
return value;
|
|
61
|
+
}
|
|
62
|
+
};
|
|
63
|
+
/** Creates a `jsonb` column. Stores JSON in decomposed binary format for efficient querying. Maps to `unknown` (use `$type<T>()` to narrow). */
|
|
64
|
+
function jsonb(config) {
|
|
65
|
+
return new JsonbColumn(config);
|
|
66
|
+
}
|
|
67
|
+
//#endregion
|
|
68
|
+
export { jsonb };
|
|
@@ -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/macaddr.d.ts
|
|
6
|
+
type MacaddrValType = string;
|
|
7
|
+
type MacaddrConfig = ColumnConfig;
|
|
8
|
+
declare class MacaddrColumn<TConfig extends MacaddrConfig> extends Column<TConfig, MacaddrValType> {
|
|
9
|
+
static readonly id = "Column.Macaddr";
|
|
10
|
+
get sqlTypeScalar(): string;
|
|
11
|
+
get zodTypeScaler(): z.ZodMAC;
|
|
12
|
+
toDriverScalar(value: MacaddrValType | Sql | null): string | null;
|
|
13
|
+
toSQLScalar(value: string | Sql | null): string;
|
|
14
|
+
fromDriverScalar(value: string | null): MacaddrValType | null;
|
|
15
|
+
}
|
|
16
|
+
/** Creates a `macaddr` column. PostgreSQL MAC address type, maps to `string`. */
|
|
17
|
+
declare function macaddr<TConfig extends MacaddrConfig>(config: TConfig): MacaddrColumn<TConfig>;
|
|
18
|
+
//#endregion
|
|
19
|
+
export { macaddr };
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
import { Column } from "./common.mjs";
|
|
2
|
+
import { Sql } from "../sql.mjs";
|
|
3
|
+
import * as z from "zod";
|
|
4
|
+
//#region src/columns/macaddr.ts
|
|
5
|
+
var MacaddrColumn = class extends Column {
|
|
6
|
+
static id = "Column.Macaddr";
|
|
7
|
+
get sqlTypeScalar() {
|
|
8
|
+
return "macaddr";
|
|
9
|
+
}
|
|
10
|
+
get zodTypeScaler() {
|
|
11
|
+
return z.mac();
|
|
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.replace(/'/g, "''")}'`;
|
|
21
|
+
}
|
|
22
|
+
fromDriverScalar(value) {
|
|
23
|
+
return value;
|
|
24
|
+
}
|
|
25
|
+
};
|
|
26
|
+
/** Creates a `macaddr` column. PostgreSQL MAC address type, maps to `string`. */
|
|
27
|
+
function macaddr(config) {
|
|
28
|
+
return new MacaddrColumn(config);
|
|
29
|
+
}
|
|
30
|
+
//#endregion
|
|
31
|
+
export { macaddr };
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
import { Sql } from "../sql.mjs";
|
|
2
|
+
import { Column, ColumnConfig } from "./common.mjs";
|
|
3
|
+
import * as z from "zod";
|
|
4
|
+
|
|
5
|
+
//#region src/columns/numeric.d.ts
|
|
6
|
+
type NumericValType = string;
|
|
7
|
+
type NumericConfig = ColumnConfig & {
|
|
8
|
+
/**
|
|
9
|
+
* The total number of significant digits (1-1000).
|
|
10
|
+
* If omitted, values of any precision can be stored.
|
|
11
|
+
*/
|
|
12
|
+
precision?: number;
|
|
13
|
+
/**
|
|
14
|
+
* The number of digits after the decimal point.
|
|
15
|
+
* If omitted, defaults to 0 when precision is specified.
|
|
16
|
+
*/
|
|
17
|
+
scale?: number;
|
|
18
|
+
};
|
|
19
|
+
declare class NumericColumn<TConfig extends NumericConfig> extends Column<TConfig, NumericValType> {
|
|
20
|
+
#private;
|
|
21
|
+
static readonly id = "Column.Numeric";
|
|
22
|
+
constructor(config: TConfig);
|
|
23
|
+
get sqlTypeScalar(): string;
|
|
24
|
+
get zodTypeScaler(): z.ZodString;
|
|
25
|
+
toDriverScalar(value: NumericValType | Sql | null): string | null;
|
|
26
|
+
toSQLScalar(value: string | Sql | null): string;
|
|
27
|
+
fromDriverScalar(value: string | null): NumericValType | null;
|
|
28
|
+
}
|
|
29
|
+
/**
|
|
30
|
+
* Creates a `numeric` column. Arbitrary-precision number, maps to `string` to avoid floating-point loss.
|
|
31
|
+
*
|
|
32
|
+
* @example
|
|
33
|
+
* ```ts
|
|
34
|
+
* numeric({ precision: 10, scale: 2, notNull }) // numeric(10,2) NOT NULL
|
|
35
|
+
* ```
|
|
36
|
+
*
|
|
37
|
+
* @param config.precision - Total significant digits (1–1000). Omit for unlimited.
|
|
38
|
+
* @param config.scale - Digits after the decimal point. Defaults to 0 when precision is set.
|
|
39
|
+
*/
|
|
40
|
+
declare function numeric<TConfig extends NumericConfig>(config: TConfig): NumericColumn<TConfig>;
|
|
41
|
+
//#endregion
|
|
42
|
+
export { numeric };
|
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
import { Column } from "./common.mjs";
|
|
2
|
+
import { Sql } from "../sql.mjs";
|
|
3
|
+
import * as z from "zod";
|
|
4
|
+
//#region src/columns/numeric.ts
|
|
5
|
+
var NumericColumn = class extends Column {
|
|
6
|
+
static id = "Column.Numeric";
|
|
7
|
+
#precision;
|
|
8
|
+
#scale;
|
|
9
|
+
constructor(config) {
|
|
10
|
+
super(config);
|
|
11
|
+
this.#precision = config.precision;
|
|
12
|
+
this.#scale = config.scale;
|
|
13
|
+
}
|
|
14
|
+
get sqlTypeScalar() {
|
|
15
|
+
if (this.#precision !== void 0) {
|
|
16
|
+
if (this.#scale !== void 0) return `numeric(${this.#precision},${this.#scale})`;
|
|
17
|
+
return `numeric(${this.#precision})`;
|
|
18
|
+
}
|
|
19
|
+
return "numeric";
|
|
20
|
+
}
|
|
21
|
+
get zodTypeScaler() {
|
|
22
|
+
return z.string().refine((val) => {
|
|
23
|
+
const num = Number(val);
|
|
24
|
+
return !Number.isNaN(num) && Number.isFinite(num);
|
|
25
|
+
}, { message: "Invalid numeric value" });
|
|
26
|
+
}
|
|
27
|
+
toDriverScalar(value) {
|
|
28
|
+
if (value === null) return null;
|
|
29
|
+
return value instanceof Sql ? value.string : value;
|
|
30
|
+
}
|
|
31
|
+
toSQLScalar(value) {
|
|
32
|
+
if (value === null) return "NULL";
|
|
33
|
+
if (value instanceof Sql) return value.string;
|
|
34
|
+
Number(value);
|
|
35
|
+
return value;
|
|
36
|
+
}
|
|
37
|
+
fromDriverScalar(value) {
|
|
38
|
+
if (value === null) return null;
|
|
39
|
+
return typeof value === "string" ? value : String(value);
|
|
40
|
+
}
|
|
41
|
+
};
|
|
42
|
+
/**
|
|
43
|
+
* Creates a `numeric` column. Arbitrary-precision number, maps to `string` to avoid floating-point loss.
|
|
44
|
+
*
|
|
45
|
+
* @example
|
|
46
|
+
* ```ts
|
|
47
|
+
* numeric({ precision: 10, scale: 2, notNull }) // numeric(10,2) NOT NULL
|
|
48
|
+
* ```
|
|
49
|
+
*
|
|
50
|
+
* @param config.precision - Total significant digits (1–1000). Omit for unlimited.
|
|
51
|
+
* @param config.scale - Digits after the decimal point. Defaults to 0 when precision is set.
|
|
52
|
+
*/
|
|
53
|
+
function numeric(config) {
|
|
54
|
+
return new NumericColumn(config);
|
|
55
|
+
}
|
|
56
|
+
//#endregion
|
|
57
|
+
export { numeric };
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { linestring } from "./linestring.mjs";
|
|
2
|
+
import { multilinestring } from "./multilinestring.mjs";
|
|
3
|
+
import { multipoint } from "./multipoint.mjs";
|
|
4
|
+
import { multipolygon } from "./multipolygon.mjs";
|
|
5
|
+
import { point } from "./point.mjs";
|
|
6
|
+
import { polygon } from "./polygon.mjs";
|
|
7
|
+
|
|
8
|
+
//#region src/columns/postgis/geography/index.d.ts
|
|
9
|
+
declare const geography: {
|
|
10
|
+
point: typeof point;
|
|
11
|
+
multipoint: typeof multipoint;
|
|
12
|
+
linestring: typeof linestring;
|
|
13
|
+
multilinestring: typeof multilinestring;
|
|
14
|
+
polygon: typeof polygon;
|
|
15
|
+
multipolygon: typeof multipolygon;
|
|
16
|
+
};
|
|
17
|
+
//#endregion
|
|
18
|
+
export { geography };
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { linestring } from "./linestring.mjs";
|
|
2
|
+
import { multilinestring } from "./multilinestring.mjs";
|
|
3
|
+
import { multipoint } from "./multipoint.mjs";
|
|
4
|
+
import { multipolygon } from "./multipolygon.mjs";
|
|
5
|
+
import { point } from "./point.mjs";
|
|
6
|
+
import { polygon } from "./polygon.mjs";
|
|
7
|
+
//#region src/columns/postgis/geography/index.ts
|
|
8
|
+
const geography = {
|
|
9
|
+
point,
|
|
10
|
+
multipoint,
|
|
11
|
+
linestring,
|
|
12
|
+
multilinestring,
|
|
13
|
+
polygon,
|
|
14
|
+
multipolygon
|
|
15
|
+
};
|
|
16
|
+
//#endregion
|
|
17
|
+
export { geography };
|
|
@@ -0,0 +1,38 @@
|
|
|
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/linestring.d.ts
|
|
6
|
+
type As = "xy" | "xyz" | "xym" | "xyzm";
|
|
7
|
+
type LineStringConfig = 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 GetValType<T extends As | undefined> = SelfOrReadonly<GetPointType<T>[]>;
|
|
13
|
+
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>;
|
|
14
|
+
type GetZodType<T extends As | undefined> = z.ZodArray<GetPointZodType<T>>;
|
|
15
|
+
declare class LineStringColumn<TConfig extends LineStringConfig> extends Column<TConfig, GetValType<TConfig["format"]>> {
|
|
16
|
+
#private;
|
|
17
|
+
static readonly id = "Column.Geography.LineString";
|
|
18
|
+
constructor(config: TConfig);
|
|
19
|
+
get sqlTypeScalar(): string;
|
|
20
|
+
get zodTypeScaler(): GetZodType<TConfig["format"]>;
|
|
21
|
+
toDriverScalar(value: GetValType<TConfig["format"]> | Sql | null): string | null;
|
|
22
|
+
toSQLScalar(value: GetValType<TConfig["format"]> | Sql | null): string;
|
|
23
|
+
fromDriverScalar(value: string | null): GetValType<TConfig["format"]> | null;
|
|
24
|
+
}
|
|
25
|
+
/**
|
|
26
|
+
* Creates a PostGIS `geography(LINESTRING)` column. Maps to an array of `[lon, lat]` tuples.
|
|
27
|
+
*
|
|
28
|
+
* @example
|
|
29
|
+
* ```ts
|
|
30
|
+
* geography.linestring({ srid: 4326 }) // geography(LINESTRING, 4326)
|
|
31
|
+
* ```
|
|
32
|
+
*
|
|
33
|
+
* @param config.srid - Spatial reference ID (default: 4326)
|
|
34
|
+
* @param config.format - Coordinate format: `"xy"` (default: `"xy"`)
|
|
35
|
+
*/
|
|
36
|
+
declare function linestring<TConfig extends LineStringConfig>(config: TConfig): LineStringColumn<TConfig>;
|
|
37
|
+
//#endregion
|
|
38
|
+
export { linestring };
|
|
@@ -0,0 +1,70 @@
|
|
|
1
|
+
import { Column } from "../../common.mjs";
|
|
2
|
+
import { Sql } from "../../../sql.mjs";
|
|
3
|
+
import { LineString } from "../../../wkx/linestring.mjs";
|
|
4
|
+
import "../../../wkx/index.mjs";
|
|
5
|
+
import * as z from "zod";
|
|
6
|
+
//#region src/columns/postgis/geography/linestring.ts
|
|
7
|
+
var LineStringColumn = class extends Column {
|
|
8
|
+
static id = "Column.Geography.LineString";
|
|
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(LINESTRING, ${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(pointTuple);
|
|
26
|
+
}
|
|
27
|
+
toDriverScalar(value) {
|
|
28
|
+
if (value === null) return null;
|
|
29
|
+
if (value instanceof Sql) return value.string;
|
|
30
|
+
const lineString = LineString.parseGeoJSON({
|
|
31
|
+
type: "LineString",
|
|
32
|
+
coordinates: value
|
|
33
|
+
});
|
|
34
|
+
return `SRID=${this.#srid};${lineString.toWkt()}`;
|
|
35
|
+
}
|
|
36
|
+
toSQLScalar(value) {
|
|
37
|
+
if (value === null) return "NULL";
|
|
38
|
+
if (value instanceof Sql) return value.string;
|
|
39
|
+
const lineString = LineString.parseGeoJSON({
|
|
40
|
+
type: "LineString",
|
|
41
|
+
coordinates: value
|
|
42
|
+
});
|
|
43
|
+
return `'SRID=${this.#srid};${lineString.toWkt()}'`;
|
|
44
|
+
}
|
|
45
|
+
fromDriverScalar(value) {
|
|
46
|
+
if (value === null) return value;
|
|
47
|
+
const buffer = Buffer.from(value, "hex");
|
|
48
|
+
return LineString.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(LINESTRING)` column. Maps to an array of `[lon, lat]` tuples.
|
|
57
|
+
*
|
|
58
|
+
* @example
|
|
59
|
+
* ```ts
|
|
60
|
+
* geography.linestring({ srid: 4326 }) // geography(LINESTRING, 4326)
|
|
61
|
+
* ```
|
|
62
|
+
*
|
|
63
|
+
* @param config.srid - Spatial reference ID (default: 4326)
|
|
64
|
+
* @param config.format - Coordinate format: `"xy"` (default: `"xy"`)
|
|
65
|
+
*/
|
|
66
|
+
function linestring(config) {
|
|
67
|
+
return new LineStringColumn(config);
|
|
68
|
+
}
|
|
69
|
+
//#endregion
|
|
70
|
+
export { linestring };
|
|
@@ -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/multilinestring.d.ts
|
|
6
|
+
type As = "xy" | "xyz" | "xym" | "xyzm";
|
|
7
|
+
type MultiLineStringConfig = 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 GetLineType<T extends As | undefined> = SelfOrReadonly<GetPointType<T>[]>;
|
|
13
|
+
type GetValType<T extends As | undefined> = SelfOrReadonly<GetLineType<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 MultiLineStringColumn<TConfig extends MultiLineStringConfig> extends Column<TConfig, GetValType<TConfig["format"]>> {
|
|
17
|
+
#private;
|
|
18
|
+
static readonly id = "Column.Geography.MultiLineString";
|
|
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(MULTILINESTRING)` column. Maps to an array of linestrings.
|
|
28
|
+
*
|
|
29
|
+
* @example
|
|
30
|
+
* ```ts
|
|
31
|
+
* geography.multilinestring({ srid: 4326 }) // geography(MULTILINESTRING, 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 multilinestring<TConfig extends MultiLineStringConfig>(config: TConfig): MultiLineStringColumn<TConfig>;
|
|
38
|
+
//#endregion
|
|
39
|
+
export { multilinestring };
|
|
@@ -0,0 +1,70 @@
|
|
|
1
|
+
import { Column } from "../../common.mjs";
|
|
2
|
+
import { Sql } from "../../../sql.mjs";
|
|
3
|
+
import { MultiLineString } from "../../../wkx/multilinestring.mjs";
|
|
4
|
+
import "../../../wkx/index.mjs";
|
|
5
|
+
import * as z from "zod";
|
|
6
|
+
//#region src/columns/postgis/geography/multilinestring.ts
|
|
7
|
+
var MultiLineStringColumn = class extends Column {
|
|
8
|
+
static id = "Column.Geography.MultiLineString";
|
|
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(MULTILINESTRING, ${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 multiLineString = MultiLineString.parseGeoJSON({
|
|
31
|
+
type: "MultiLineString",
|
|
32
|
+
coordinates: value
|
|
33
|
+
});
|
|
34
|
+
return `SRID=${this.#srid};${multiLineString.toWkt()}`;
|
|
35
|
+
}
|
|
36
|
+
toSQLScalar(value) {
|
|
37
|
+
if (value === null) return "NULL";
|
|
38
|
+
if (value instanceof Sql) return value.string;
|
|
39
|
+
const multiLineString = MultiLineString.parseGeoJSON({
|
|
40
|
+
type: "MultiLineString",
|
|
41
|
+
coordinates: value
|
|
42
|
+
});
|
|
43
|
+
return `'SRID=${this.#srid};${multiLineString.toWkt()}'`;
|
|
44
|
+
}
|
|
45
|
+
fromDriverScalar(value) {
|
|
46
|
+
if (value === null) return value;
|
|
47
|
+
const buffer = Buffer.from(value, "hex");
|
|
48
|
+
return MultiLineString.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(MULTILINESTRING)` column. Maps to an array of linestrings.
|
|
57
|
+
*
|
|
58
|
+
* @example
|
|
59
|
+
* ```ts
|
|
60
|
+
* geography.multilinestring({ srid: 4326 }) // geography(MULTILINESTRING, 4326)
|
|
61
|
+
* ```
|
|
62
|
+
*
|
|
63
|
+
* @param config.srid - Spatial reference ID (default: 4326)
|
|
64
|
+
* @param config.format - Coordinate format: `"xy"` (default: `"xy"`)
|
|
65
|
+
*/
|
|
66
|
+
function multilinestring(config) {
|
|
67
|
+
return new MultiLineStringColumn(config);
|
|
68
|
+
}
|
|
69
|
+
//#endregion
|
|
70
|
+
export { multilinestring };
|
|
@@ -0,0 +1,38 @@
|
|
|
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/multipoint.d.ts
|
|
6
|
+
type As = "xy" | "xyz" | "xym" | "xyzm";
|
|
7
|
+
type MultiPointConfig = 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 GetValType<T extends As | undefined> = SelfOrReadonly<GetPointType<T>[]>;
|
|
13
|
+
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>;
|
|
14
|
+
type GetZodType<T extends As | undefined> = z.ZodArray<GetPointZodType<T>>;
|
|
15
|
+
declare class MultiPointColumn<TConfig extends MultiPointConfig> extends Column<TConfig, GetValType<TConfig["format"]>> {
|
|
16
|
+
#private;
|
|
17
|
+
static readonly id = "Column.Geography.MultiPoint";
|
|
18
|
+
constructor(config: TConfig);
|
|
19
|
+
get sqlTypeScalar(): string;
|
|
20
|
+
get zodTypeScaler(): GetZodType<TConfig["format"]>;
|
|
21
|
+
toDriverScalar(value: GetValType<TConfig["format"]> | Sql | null): string | null;
|
|
22
|
+
toSQLScalar(value: GetValType<TConfig["format"]> | Sql | null): string;
|
|
23
|
+
fromDriverScalar(value: string | null): GetValType<TConfig["format"]> | null;
|
|
24
|
+
}
|
|
25
|
+
/**
|
|
26
|
+
* Creates a PostGIS `geography(MULTIPOINT)` column. Maps to an array of `[lon, lat]` tuples.
|
|
27
|
+
*
|
|
28
|
+
* @example
|
|
29
|
+
* ```ts
|
|
30
|
+
* geography.multipoint({ srid: 4326 }) // geography(MULTIPOINT, 4326)
|
|
31
|
+
* ```
|
|
32
|
+
*
|
|
33
|
+
* @param config.srid - Spatial reference ID (default: 4326)
|
|
34
|
+
* @param config.format - Coordinate format: `"xy"` (default: `"xy"`)
|
|
35
|
+
*/
|
|
36
|
+
declare function multipoint<TConfig extends MultiPointConfig>(config: TConfig): MultiPointColumn<TConfig>;
|
|
37
|
+
//#endregion
|
|
38
|
+
export { multipoint };
|
|
@@ -0,0 +1,70 @@
|
|
|
1
|
+
import { Column } from "../../common.mjs";
|
|
2
|
+
import { Sql } from "../../../sql.mjs";
|
|
3
|
+
import { MultiPoint } from "../../../wkx/multipoint.mjs";
|
|
4
|
+
import "../../../wkx/index.mjs";
|
|
5
|
+
import * as z from "zod";
|
|
6
|
+
//#region src/columns/postgis/geography/multipoint.ts
|
|
7
|
+
var MultiPointColumn = class extends Column {
|
|
8
|
+
static id = "Column.Geography.MultiPoint";
|
|
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(MULTIPOINT, ${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(pointTuple);
|
|
26
|
+
}
|
|
27
|
+
toDriverScalar(value) {
|
|
28
|
+
if (value === null) return null;
|
|
29
|
+
if (value instanceof Sql) return value.string;
|
|
30
|
+
const multiPoint = MultiPoint.parseGeoJSON({
|
|
31
|
+
type: "MultiPoint",
|
|
32
|
+
coordinates: value
|
|
33
|
+
});
|
|
34
|
+
return `SRID=${this.#srid};${multiPoint.toWkt()}`;
|
|
35
|
+
}
|
|
36
|
+
toSQLScalar(value) {
|
|
37
|
+
if (value === null) return "NULL";
|
|
38
|
+
if (value instanceof Sql) return value.string;
|
|
39
|
+
const multiPoint = MultiPoint.parseGeoJSON({
|
|
40
|
+
type: "MultiPoint",
|
|
41
|
+
coordinates: value
|
|
42
|
+
});
|
|
43
|
+
return `'SRID=${this.#srid};${multiPoint.toWkt()}'`;
|
|
44
|
+
}
|
|
45
|
+
fromDriverScalar(value) {
|
|
46
|
+
if (value === null) return value;
|
|
47
|
+
const buffer = Buffer.from(value, "hex");
|
|
48
|
+
return MultiPoint.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(MULTIPOINT)` column. Maps to an array of `[lon, lat]` tuples.
|
|
57
|
+
*
|
|
58
|
+
* @example
|
|
59
|
+
* ```ts
|
|
60
|
+
* geography.multipoint({ srid: 4326 }) // geography(MULTIPOINT, 4326)
|
|
61
|
+
* ```
|
|
62
|
+
*
|
|
63
|
+
* @param config.srid - Spatial reference ID (default: 4326)
|
|
64
|
+
* @param config.format - Coordinate format: `"xy"` (default: `"xy"`)
|
|
65
|
+
*/
|
|
66
|
+
function multipoint(config) {
|
|
67
|
+
return new MultiPointColumn(config);
|
|
68
|
+
}
|
|
69
|
+
//#endregion
|
|
70
|
+
export { multipoint };
|
|
@@ -0,0 +1,40 @@
|
|
|
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/multipolygon.d.ts
|
|
6
|
+
type As = "xy" | "xyz" | "xym" | "xyzm";
|
|
7
|
+
type MultiPolygonConfig = 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 GetPolygonType<T extends As | undefined> = SelfOrReadonly<GetRingType<T>[]>;
|
|
14
|
+
type GetValType<T extends As | undefined> = SelfOrReadonly<GetPolygonType<T>[]>;
|
|
15
|
+
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>;
|
|
16
|
+
type GetZodType<T extends As | undefined> = z.ZodArray<z.ZodArray<z.ZodArray<GetPointZodType<T>>>>;
|
|
17
|
+
declare class MultiPolygonColumn<TConfig extends MultiPolygonConfig> extends Column<TConfig, GetValType<TConfig["format"]>> {
|
|
18
|
+
#private;
|
|
19
|
+
static readonly id = "Column.Geography.MultiPolygon";
|
|
20
|
+
constructor(config: TConfig);
|
|
21
|
+
get sqlTypeScalar(): string;
|
|
22
|
+
get zodTypeScaler(): GetZodType<TConfig["format"]>;
|
|
23
|
+
toDriverScalar(value: GetValType<TConfig["format"]> | Sql | null): string | null;
|
|
24
|
+
toSQLScalar(value: GetValType<TConfig["format"]> | Sql | null): string;
|
|
25
|
+
fromDriverScalar(value: string | null): GetValType<TConfig["format"]> | null;
|
|
26
|
+
}
|
|
27
|
+
/**
|
|
28
|
+
* Creates a PostGIS `geography(MULTIPOLYGON)` column. Maps to an array of polygons.
|
|
29
|
+
*
|
|
30
|
+
* @example
|
|
31
|
+
* ```ts
|
|
32
|
+
* geography.multipolygon({ srid: 4326 }) // geography(MULTIPOLYGON, 4326)
|
|
33
|
+
* ```
|
|
34
|
+
*
|
|
35
|
+
* @param config.srid - Spatial reference ID (default: 4326)
|
|
36
|
+
* @param config.format - Coordinate format: `"xy"` (default: `"xy"`)
|
|
37
|
+
*/
|
|
38
|
+
declare function multipolygon<TConfig extends MultiPolygonConfig>(config: TConfig): MultiPolygonColumn<TConfig>;
|
|
39
|
+
//#endregion
|
|
40
|
+
export { multipolygon };
|