effect-qb 0.13.0 → 0.15.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/README.md +6 -1431
- package/dist/mysql.js +61945 -3611
- package/dist/postgres/metadata.js +2818 -0
- package/dist/postgres.js +9942 -5591
- package/package.json +21 -10
- package/src/internal/aggregation-validation.ts +3 -3
- package/src/internal/case-analysis.d.ts +18 -0
- package/src/internal/case-analysis.ts +4 -4
- package/src/internal/coercion/analysis.d.ts +7 -0
- package/src/internal/{coercion-analysis.ts → coercion/analysis.ts} +3 -3
- package/src/internal/coercion/errors.d.ts +17 -0
- package/src/internal/{coercion-errors.ts → coercion/errors.ts} +1 -1
- package/src/internal/coercion/kind.d.ts +4 -0
- package/src/internal/{coercion-kind.ts → coercion/kind.ts} +2 -2
- package/src/internal/{coercion-normalize.ts → coercion/normalize.ts} +1 -1
- package/src/internal/coercion/rules.d.ts +6 -0
- package/src/internal/{coercion-rules.ts → coercion/rules.ts} +2 -2
- package/src/internal/column-state.d.ts +190 -0
- package/src/internal/column-state.ts +119 -56
- package/src/internal/column.ts +387 -149
- package/src/internal/datatypes/define.d.ts +17 -0
- package/src/internal/datatypes/define.ts +18 -34
- package/src/internal/datatypes/lookup.d.ts +44 -0
- package/src/internal/datatypes/lookup.ts +61 -152
- package/src/internal/datatypes/shape.d.ts +16 -0
- package/src/internal/datatypes/shape.ts +1 -1
- package/src/internal/derived-table.d.ts +4 -0
- package/src/internal/derived-table.ts +21 -16
- package/src/internal/dsl-mutation-runtime.ts +378 -0
- package/src/internal/dsl-plan-runtime.ts +387 -0
- package/src/internal/dsl-query-runtime.ts +160 -0
- package/src/internal/dsl-transaction-ddl-runtime.ts +263 -0
- package/src/internal/executor.ts +173 -38
- package/src/internal/expression-ast.ts +19 -5
- package/src/internal/grouping-key.d.ts +3 -0
- package/src/internal/grouping-key.ts +1 -1
- package/src/internal/implication-runtime.d.ts +15 -0
- package/src/internal/implication-runtime.ts +171 -0
- package/src/internal/json/ast.d.ts +30 -0
- package/src/internal/json/ast.ts +1 -1
- package/src/internal/json/errors.d.ts +8 -0
- package/src/internal/json/path.d.ts +75 -0
- package/src/internal/json/path.ts +1 -1
- package/src/internal/json/types.d.ts +62 -0
- package/src/internal/predicate/analysis.d.ts +20 -0
- package/src/internal/{predicate-analysis.ts → predicate/analysis.ts} +13 -3
- package/src/internal/predicate/atom.d.ts +28 -0
- package/src/internal/{predicate-branches.ts → predicate/branches.ts} +2 -2
- package/src/internal/predicate/context.d.ts +67 -0
- package/src/internal/{predicate-context.ts → predicate/context.ts} +111 -32
- package/src/internal/predicate/formula.d.ts +35 -0
- package/src/internal/{predicate-formula.ts → predicate/formula.ts} +32 -20
- package/src/internal/predicate/key.d.ts +11 -0
- package/src/internal/{predicate-key.ts → predicate/key.ts} +2 -2
- package/src/internal/{predicate-nnf.ts → predicate/nnf.ts} +2 -2
- package/src/internal/predicate/normalize.d.ts +53 -0
- package/src/internal/predicate/normalize.ts +273 -0
- package/src/internal/predicate/runtime.d.ts +31 -0
- package/src/internal/predicate/runtime.ts +679 -0
- package/src/internal/projection-alias.d.ts +13 -0
- package/src/internal/projections.d.ts +31 -0
- package/src/internal/projections.ts +1 -1
- package/src/internal/query-ast.d.ts +217 -0
- package/src/internal/query-ast.ts +1 -1
- package/src/internal/query-requirements.d.ts +20 -0
- package/src/internal/query.d.ts +775 -0
- package/src/internal/query.ts +767 -275
- package/src/internal/renderer.ts +7 -21
- package/src/internal/row-set.d.ts +53 -0
- package/src/internal/{plan.ts → row-set.ts} +23 -11
- package/src/internal/{runtime-normalize.ts → runtime/normalize.ts} +9 -31
- package/src/internal/{runtime-schema.ts → runtime/schema.ts} +84 -55
- package/src/internal/runtime/value.d.ts +22 -0
- package/src/internal/{runtime-value.ts → runtime/value.ts} +2 -2
- package/src/internal/scalar.d.ts +107 -0
- package/src/internal/scalar.ts +191 -0
- package/src/internal/schema-derivation.d.ts +105 -0
- package/src/internal/schema-derivation.ts +93 -21
- package/src/internal/schema-expression.d.ts +18 -0
- package/src/internal/schema-expression.ts +75 -0
- package/src/internal/table-options.d.ts +94 -0
- package/src/internal/table-options.ts +94 -8
- package/src/internal/table.d.ts +173 -0
- package/src/internal/table.ts +135 -54
- package/src/mysql/column.ts +95 -18
- package/src/mysql/datatypes/index.ts +58 -3
- package/src/mysql/errors/generated.ts +57336 -0
- package/src/mysql/errors/index.ts +1 -0
- package/src/mysql/errors/normalize.ts +55 -53
- package/src/mysql/errors/types.ts +74 -0
- package/src/mysql/executor.ts +69 -7
- package/src/mysql/function/aggregate.ts +1 -5
- package/src/mysql/function/core.ts +1 -3
- package/src/mysql/function/index.ts +1 -1
- package/src/mysql/function/string.ts +1 -5
- package/src/mysql/function/temporal.ts +12 -15
- package/src/mysql/function/window.ts +1 -6
- package/src/{internal/mysql-dialect.ts → mysql/internal/dialect.ts} +1 -1
- package/src/mysql/internal/dsl.ts +6115 -0
- package/src/{internal/mysql-renderer.ts → mysql/internal/renderer.ts} +6 -6
- package/src/mysql/internal/sql-expression-renderer.ts +1455 -0
- package/src/mysql/json.ts +2 -0
- package/src/mysql/query.ts +111 -86
- package/src/mysql/renderer.ts +1 -1
- package/src/mysql/table.ts +1 -1
- package/src/mysql.ts +6 -4
- package/src/postgres/cast.ts +30 -0
- package/src/postgres/column.ts +178 -20
- package/src/postgres/datatypes/index.d.ts +515 -0
- package/src/postgres/datatypes/index.ts +49 -5
- package/src/postgres/datatypes/spec.d.ts +412 -0
- package/src/postgres/errors/generated.ts +2636 -0
- package/src/postgres/errors/index.ts +1 -0
- package/src/postgres/errors/normalize.ts +47 -62
- package/src/postgres/errors/types.ts +92 -34
- package/src/postgres/executor.ts +37 -5
- package/src/postgres/function/aggregate.ts +1 -5
- package/src/postgres/function/core.ts +20 -2
- package/src/postgres/function/index.ts +1 -1
- package/src/postgres/function/string.ts +1 -5
- package/src/postgres/function/temporal.ts +12 -15
- package/src/postgres/function/window.ts +1 -6
- package/src/{internal/postgres-dialect.ts → postgres/internal/dialect.ts} +1 -1
- package/src/{internal/query-factory.ts → postgres/internal/dsl.ts} +1568 -2120
- package/src/{internal/postgres-renderer.ts → postgres/internal/renderer.ts} +6 -6
- package/src/postgres/internal/schema-ddl.ts +108 -0
- package/src/postgres/internal/schema-model.ts +150 -0
- package/src/{internal → postgres/internal}/sql-expression-renderer.ts +112 -46
- package/src/postgres/json.ts +493 -0
- package/src/postgres/metadata.ts +31 -0
- package/src/postgres/query.ts +113 -86
- package/src/postgres/renderer.ts +3 -13
- package/src/postgres/schema-expression.ts +17 -0
- package/src/postgres/schema-management.ts +204 -0
- package/src/postgres/schema.ts +35 -0
- package/src/postgres/table.ts +316 -42
- package/src/postgres/type.ts +31 -0
- package/src/postgres.ts +20 -4
- package/CHANGELOG.md +0 -134
- package/src/internal/expression.ts +0 -327
- package/src/internal/predicate-normalize.ts +0 -202
- package/src/mysql/function/json.ts +0 -4
- package/src/mysql/private/query.ts +0 -13
- package/src/postgres/function/json.ts +0 -4
- package/src/postgres/private/query.ts +0 -13
- /package/src/internal/{predicate-atom.ts → predicate/atom.ts} +0 -0
|
@@ -0,0 +1,515 @@
|
|
|
1
|
+
import type * as Expression from "../../internal/scalar.js";
|
|
2
|
+
import { postgresDatatypeFamilies, postgresDatatypeKinds } from "./spec.js";
|
|
3
|
+
export declare const postgresDatatypes: {
|
|
4
|
+
custom: <Kind extends string>(kind: Kind) => Expression.DbType.Base<"postgres", Kind>;
|
|
5
|
+
text: () => Expression.DbType.Base<"postgres", "text"> & {
|
|
6
|
+
readonly family: "text";
|
|
7
|
+
readonly runtime: "string";
|
|
8
|
+
readonly compareGroup: "text";
|
|
9
|
+
readonly castTargets: readonly ["text", "numeric", "boolean", "date", "time", "timestamp", "interval", "binary", "uuid", "json", "xml", "bit", "oid", "identifier", "network", "spatial", "textsearch", "range", "multirange", "array", "money", "null"];
|
|
10
|
+
readonly traits: {
|
|
11
|
+
readonly textual: true;
|
|
12
|
+
readonly ordered: true;
|
|
13
|
+
};
|
|
14
|
+
};
|
|
15
|
+
varchar: () => Expression.DbType.Base<"postgres", "varchar"> & {
|
|
16
|
+
readonly family: "text";
|
|
17
|
+
readonly runtime: "string";
|
|
18
|
+
readonly compareGroup: "text";
|
|
19
|
+
readonly castTargets: readonly ["text", "numeric", "boolean", "date", "time", "timestamp", "interval", "binary", "uuid", "json", "xml", "bit", "oid", "identifier", "network", "spatial", "textsearch", "range", "multirange", "array", "money", "null"];
|
|
20
|
+
readonly traits: {
|
|
21
|
+
readonly textual: true;
|
|
22
|
+
readonly ordered: true;
|
|
23
|
+
};
|
|
24
|
+
};
|
|
25
|
+
char: () => Expression.DbType.Base<"postgres", "char"> & {
|
|
26
|
+
readonly family: "text";
|
|
27
|
+
readonly runtime: "string";
|
|
28
|
+
readonly compareGroup: "text";
|
|
29
|
+
readonly castTargets: readonly ["text", "numeric", "boolean", "date", "time", "timestamp", "interval", "binary", "uuid", "json", "xml", "bit", "oid", "identifier", "network", "spatial", "textsearch", "range", "multirange", "array", "money", "null"];
|
|
30
|
+
readonly traits: {
|
|
31
|
+
readonly textual: true;
|
|
32
|
+
readonly ordered: true;
|
|
33
|
+
};
|
|
34
|
+
};
|
|
35
|
+
citext: () => Expression.DbType.Base<"postgres", "citext"> & {
|
|
36
|
+
readonly family: "text";
|
|
37
|
+
readonly runtime: "string";
|
|
38
|
+
readonly compareGroup: "text";
|
|
39
|
+
readonly castTargets: readonly ["text", "numeric", "boolean", "date", "time", "timestamp", "interval", "binary", "uuid", "json", "xml", "bit", "oid", "identifier", "network", "spatial", "textsearch", "range", "multirange", "array", "money", "null"];
|
|
40
|
+
readonly traits: {
|
|
41
|
+
readonly textual: true;
|
|
42
|
+
readonly ordered: true;
|
|
43
|
+
};
|
|
44
|
+
};
|
|
45
|
+
name: () => Expression.DbType.Base<"postgres", "name"> & {
|
|
46
|
+
readonly family: "text";
|
|
47
|
+
readonly runtime: "string";
|
|
48
|
+
readonly compareGroup: "text";
|
|
49
|
+
readonly castTargets: readonly ["text", "numeric", "boolean", "date", "time", "timestamp", "interval", "binary", "uuid", "json", "xml", "bit", "oid", "identifier", "network", "spatial", "textsearch", "range", "multirange", "array", "money", "null"];
|
|
50
|
+
readonly traits: {
|
|
51
|
+
readonly textual: true;
|
|
52
|
+
readonly ordered: true;
|
|
53
|
+
};
|
|
54
|
+
};
|
|
55
|
+
uuid: () => Expression.DbType.Base<"postgres", "uuid"> & {
|
|
56
|
+
readonly family: "uuid";
|
|
57
|
+
readonly runtime: "string";
|
|
58
|
+
readonly compareGroup: "uuid";
|
|
59
|
+
readonly castTargets: readonly ["uuid", "text"];
|
|
60
|
+
readonly traits: {
|
|
61
|
+
readonly ordered: true;
|
|
62
|
+
};
|
|
63
|
+
};
|
|
64
|
+
int2: () => Expression.DbType.Base<"postgres", "int2"> & {
|
|
65
|
+
readonly family: "numeric";
|
|
66
|
+
readonly runtime: "number";
|
|
67
|
+
readonly compareGroup: "numeric";
|
|
68
|
+
readonly castTargets: readonly ["numeric", "text", "boolean", "date", "time", "timestamp", "interval", "uuid", "bit", "oid", "money"];
|
|
69
|
+
readonly traits: {
|
|
70
|
+
readonly ordered: true;
|
|
71
|
+
};
|
|
72
|
+
};
|
|
73
|
+
int4: () => Expression.DbType.Base<"postgres", "int4"> & {
|
|
74
|
+
readonly family: "numeric";
|
|
75
|
+
readonly runtime: "number";
|
|
76
|
+
readonly compareGroup: "numeric";
|
|
77
|
+
readonly castTargets: readonly ["numeric", "text", "boolean", "date", "time", "timestamp", "interval", "uuid", "bit", "oid", "money"];
|
|
78
|
+
readonly traits: {
|
|
79
|
+
readonly ordered: true;
|
|
80
|
+
};
|
|
81
|
+
};
|
|
82
|
+
int8: () => Expression.DbType.Base<"postgres", "int8"> & {
|
|
83
|
+
readonly family: "numeric";
|
|
84
|
+
readonly runtime: "bigintString";
|
|
85
|
+
readonly compareGroup: "numeric";
|
|
86
|
+
readonly castTargets: readonly ["numeric", "text", "boolean", "date", "time", "timestamp", "interval", "uuid", "bit", "oid", "money"];
|
|
87
|
+
readonly traits: {
|
|
88
|
+
readonly ordered: true;
|
|
89
|
+
};
|
|
90
|
+
};
|
|
91
|
+
numeric: () => Expression.DbType.Base<"postgres", "numeric"> & {
|
|
92
|
+
readonly family: "numeric";
|
|
93
|
+
readonly runtime: "decimalString";
|
|
94
|
+
readonly compareGroup: "numeric";
|
|
95
|
+
readonly castTargets: readonly ["numeric", "text", "boolean", "date", "time", "timestamp", "interval", "uuid", "bit", "oid", "money"];
|
|
96
|
+
readonly traits: {
|
|
97
|
+
readonly ordered: true;
|
|
98
|
+
};
|
|
99
|
+
};
|
|
100
|
+
float4: () => Expression.DbType.Base<"postgres", "float4"> & {
|
|
101
|
+
readonly family: "numeric";
|
|
102
|
+
readonly runtime: "number";
|
|
103
|
+
readonly compareGroup: "numeric";
|
|
104
|
+
readonly castTargets: readonly ["numeric", "text", "boolean", "date", "time", "timestamp", "interval", "uuid", "bit", "oid", "money"];
|
|
105
|
+
readonly traits: {
|
|
106
|
+
readonly ordered: true;
|
|
107
|
+
};
|
|
108
|
+
};
|
|
109
|
+
float8: () => Expression.DbType.Base<"postgres", "float8"> & {
|
|
110
|
+
readonly family: "numeric";
|
|
111
|
+
readonly runtime: "number";
|
|
112
|
+
readonly compareGroup: "numeric";
|
|
113
|
+
readonly castTargets: readonly ["numeric", "text", "boolean", "date", "time", "timestamp", "interval", "uuid", "bit", "oid", "money"];
|
|
114
|
+
readonly traits: {
|
|
115
|
+
readonly ordered: true;
|
|
116
|
+
};
|
|
117
|
+
};
|
|
118
|
+
money: () => Expression.DbType.Base<"postgres", "money"> & {
|
|
119
|
+
readonly family: "money";
|
|
120
|
+
readonly runtime: "number";
|
|
121
|
+
readonly compareGroup: "money";
|
|
122
|
+
readonly castTargets: readonly ["money", "text", "numeric"];
|
|
123
|
+
readonly traits: {
|
|
124
|
+
readonly ordered: true;
|
|
125
|
+
};
|
|
126
|
+
};
|
|
127
|
+
bool: () => Expression.DbType.Base<"postgres", "bool"> & {
|
|
128
|
+
readonly family: "boolean";
|
|
129
|
+
readonly runtime: "boolean";
|
|
130
|
+
readonly compareGroup: "boolean";
|
|
131
|
+
readonly castTargets: readonly ["boolean", "text", "numeric"];
|
|
132
|
+
readonly traits: {};
|
|
133
|
+
};
|
|
134
|
+
date: () => Expression.DbType.Base<"postgres", "date"> & {
|
|
135
|
+
readonly family: "date";
|
|
136
|
+
readonly runtime: "localDate";
|
|
137
|
+
readonly compareGroup: "date";
|
|
138
|
+
readonly castTargets: readonly ["date", "timestamp", "text"];
|
|
139
|
+
readonly traits: {
|
|
140
|
+
readonly ordered: true;
|
|
141
|
+
};
|
|
142
|
+
};
|
|
143
|
+
time: () => Expression.DbType.Base<"postgres", "time"> & {
|
|
144
|
+
readonly family: "time";
|
|
145
|
+
readonly runtime: "localTime";
|
|
146
|
+
readonly compareGroup: "time";
|
|
147
|
+
readonly castTargets: readonly ["time", "timestamp", "text"];
|
|
148
|
+
readonly traits: {
|
|
149
|
+
readonly ordered: true;
|
|
150
|
+
};
|
|
151
|
+
};
|
|
152
|
+
timetz: () => Expression.DbType.Base<"postgres", "timetz"> & {
|
|
153
|
+
readonly family: "time";
|
|
154
|
+
readonly runtime: "offsetTime";
|
|
155
|
+
readonly compareGroup: "time";
|
|
156
|
+
readonly castTargets: readonly ["time", "timestamp", "text"];
|
|
157
|
+
readonly traits: {
|
|
158
|
+
readonly ordered: true;
|
|
159
|
+
};
|
|
160
|
+
};
|
|
161
|
+
timestamp: () => Expression.DbType.Base<"postgres", "timestamp"> & {
|
|
162
|
+
readonly family: "timestamp";
|
|
163
|
+
readonly runtime: "localDateTime";
|
|
164
|
+
readonly compareGroup: "timestamp";
|
|
165
|
+
readonly castTargets: readonly ["timestamp", "date", "text"];
|
|
166
|
+
readonly traits: {
|
|
167
|
+
readonly ordered: true;
|
|
168
|
+
};
|
|
169
|
+
};
|
|
170
|
+
timestamptz: () => Expression.DbType.Base<"postgres", "timestamptz"> & {
|
|
171
|
+
readonly family: "timestamp";
|
|
172
|
+
readonly runtime: "instant";
|
|
173
|
+
readonly compareGroup: "timestamp";
|
|
174
|
+
readonly castTargets: readonly ["timestamp", "date", "text"];
|
|
175
|
+
readonly traits: {
|
|
176
|
+
readonly ordered: true;
|
|
177
|
+
};
|
|
178
|
+
};
|
|
179
|
+
interval: () => Expression.DbType.Base<"postgres", "interval"> & {
|
|
180
|
+
readonly family: "interval";
|
|
181
|
+
readonly runtime: "string";
|
|
182
|
+
readonly compareGroup: "interval";
|
|
183
|
+
readonly castTargets: readonly ["interval", "text"];
|
|
184
|
+
readonly traits: {
|
|
185
|
+
readonly ordered: true;
|
|
186
|
+
};
|
|
187
|
+
};
|
|
188
|
+
bytea: () => Expression.DbType.Base<"postgres", "bytea"> & {
|
|
189
|
+
readonly family: "binary";
|
|
190
|
+
readonly runtime: "bytes";
|
|
191
|
+
readonly compareGroup: "binary";
|
|
192
|
+
readonly castTargets: readonly ["binary", "text"];
|
|
193
|
+
readonly traits: {};
|
|
194
|
+
};
|
|
195
|
+
xml: () => Expression.DbType.Base<"postgres", "xml"> & {
|
|
196
|
+
readonly family: "xml";
|
|
197
|
+
readonly runtime: "string";
|
|
198
|
+
readonly compareGroup: "xml";
|
|
199
|
+
readonly castTargets: readonly ["xml", "text"];
|
|
200
|
+
readonly traits: {};
|
|
201
|
+
};
|
|
202
|
+
bit: () => Expression.DbType.Base<"postgres", "bit"> & {
|
|
203
|
+
readonly family: "bit";
|
|
204
|
+
readonly runtime: "string";
|
|
205
|
+
readonly compareGroup: "bit";
|
|
206
|
+
readonly castTargets: readonly ["bit", "text", "numeric"];
|
|
207
|
+
readonly traits: {};
|
|
208
|
+
};
|
|
209
|
+
varbit: () => Expression.DbType.Base<"postgres", "varbit"> & {
|
|
210
|
+
readonly family: "bit";
|
|
211
|
+
readonly runtime: "string";
|
|
212
|
+
readonly compareGroup: "bit";
|
|
213
|
+
readonly castTargets: readonly ["bit", "text", "numeric"];
|
|
214
|
+
readonly traits: {};
|
|
215
|
+
};
|
|
216
|
+
oid: () => Expression.DbType.Base<"postgres", "oid"> & {
|
|
217
|
+
readonly family: "oid";
|
|
218
|
+
readonly runtime: "number";
|
|
219
|
+
readonly compareGroup: "oid";
|
|
220
|
+
readonly castTargets: readonly ["oid", "text", "numeric"];
|
|
221
|
+
readonly traits: {
|
|
222
|
+
readonly ordered: true;
|
|
223
|
+
};
|
|
224
|
+
};
|
|
225
|
+
xid: () => Expression.DbType.Base<"postgres", "xid"> & {
|
|
226
|
+
readonly family: "oid";
|
|
227
|
+
readonly runtime: "number";
|
|
228
|
+
readonly compareGroup: "oid";
|
|
229
|
+
readonly castTargets: readonly ["oid", "text", "numeric"];
|
|
230
|
+
readonly traits: {
|
|
231
|
+
readonly ordered: true;
|
|
232
|
+
};
|
|
233
|
+
};
|
|
234
|
+
xid8: () => Expression.DbType.Base<"postgres", "xid8"> & {
|
|
235
|
+
readonly family: "oid";
|
|
236
|
+
readonly runtime: "bigintString";
|
|
237
|
+
readonly compareGroup: "oid";
|
|
238
|
+
readonly castTargets: readonly ["oid", "text", "numeric"];
|
|
239
|
+
readonly traits: {
|
|
240
|
+
readonly ordered: true;
|
|
241
|
+
};
|
|
242
|
+
};
|
|
243
|
+
cid: () => Expression.DbType.Base<"postgres", "cid"> & {
|
|
244
|
+
readonly family: "oid";
|
|
245
|
+
readonly runtime: "number";
|
|
246
|
+
readonly compareGroup: "oid";
|
|
247
|
+
readonly castTargets: readonly ["oid", "text", "numeric"];
|
|
248
|
+
readonly traits: {
|
|
249
|
+
readonly ordered: true;
|
|
250
|
+
};
|
|
251
|
+
};
|
|
252
|
+
tid: () => Expression.DbType.Base<"postgres", "tid"> & {
|
|
253
|
+
readonly family: "identifier";
|
|
254
|
+
readonly runtime: "string";
|
|
255
|
+
readonly compareGroup: "identifier";
|
|
256
|
+
readonly castTargets: readonly ["identifier", "text"];
|
|
257
|
+
readonly traits: {};
|
|
258
|
+
};
|
|
259
|
+
regclass: () => Expression.DbType.Base<"postgres", "regclass"> & {
|
|
260
|
+
readonly family: "identifier";
|
|
261
|
+
readonly runtime: "string";
|
|
262
|
+
readonly compareGroup: "identifier";
|
|
263
|
+
readonly castTargets: readonly ["identifier", "text"];
|
|
264
|
+
readonly traits: {};
|
|
265
|
+
};
|
|
266
|
+
regtype: () => Expression.DbType.Base<"postgres", "regtype"> & {
|
|
267
|
+
readonly family: "identifier";
|
|
268
|
+
readonly runtime: "string";
|
|
269
|
+
readonly compareGroup: "identifier";
|
|
270
|
+
readonly castTargets: readonly ["identifier", "text"];
|
|
271
|
+
readonly traits: {};
|
|
272
|
+
};
|
|
273
|
+
regproc: () => Expression.DbType.Base<"postgres", "regproc"> & {
|
|
274
|
+
readonly family: "identifier";
|
|
275
|
+
readonly runtime: "string";
|
|
276
|
+
readonly compareGroup: "identifier";
|
|
277
|
+
readonly castTargets: readonly ["identifier", "text"];
|
|
278
|
+
readonly traits: {};
|
|
279
|
+
};
|
|
280
|
+
regprocedure: () => Expression.DbType.Base<"postgres", "regprocedure"> & {
|
|
281
|
+
readonly family: "identifier";
|
|
282
|
+
readonly runtime: "string";
|
|
283
|
+
readonly compareGroup: "identifier";
|
|
284
|
+
readonly castTargets: readonly ["identifier", "text"];
|
|
285
|
+
readonly traits: {};
|
|
286
|
+
};
|
|
287
|
+
regoper: () => Expression.DbType.Base<"postgres", "regoper"> & {
|
|
288
|
+
readonly family: "identifier";
|
|
289
|
+
readonly runtime: "string";
|
|
290
|
+
readonly compareGroup: "identifier";
|
|
291
|
+
readonly castTargets: readonly ["identifier", "text"];
|
|
292
|
+
readonly traits: {};
|
|
293
|
+
};
|
|
294
|
+
regoperator: () => Expression.DbType.Base<"postgres", "regoperator"> & {
|
|
295
|
+
readonly family: "identifier";
|
|
296
|
+
readonly runtime: "string";
|
|
297
|
+
readonly compareGroup: "identifier";
|
|
298
|
+
readonly castTargets: readonly ["identifier", "text"];
|
|
299
|
+
readonly traits: {};
|
|
300
|
+
};
|
|
301
|
+
regconfig: () => Expression.DbType.Base<"postgres", "regconfig"> & {
|
|
302
|
+
readonly family: "identifier";
|
|
303
|
+
readonly runtime: "string";
|
|
304
|
+
readonly compareGroup: "identifier";
|
|
305
|
+
readonly castTargets: readonly ["identifier", "text"];
|
|
306
|
+
readonly traits: {};
|
|
307
|
+
};
|
|
308
|
+
regdictionary: () => Expression.DbType.Base<"postgres", "regdictionary"> & {
|
|
309
|
+
readonly family: "identifier";
|
|
310
|
+
readonly runtime: "string";
|
|
311
|
+
readonly compareGroup: "identifier";
|
|
312
|
+
readonly castTargets: readonly ["identifier", "text"];
|
|
313
|
+
readonly traits: {};
|
|
314
|
+
};
|
|
315
|
+
pg_lsn: () => Expression.DbType.Base<"postgres", "pg_lsn"> & {
|
|
316
|
+
readonly family: "identifier";
|
|
317
|
+
readonly runtime: "string";
|
|
318
|
+
readonly compareGroup: "identifier";
|
|
319
|
+
readonly castTargets: readonly ["identifier", "text"];
|
|
320
|
+
readonly traits: {};
|
|
321
|
+
};
|
|
322
|
+
txid_snapshot: () => Expression.DbType.Base<"postgres", "txid_snapshot"> & {
|
|
323
|
+
readonly family: "identifier";
|
|
324
|
+
readonly runtime: "string";
|
|
325
|
+
readonly compareGroup: "identifier";
|
|
326
|
+
readonly castTargets: readonly ["identifier", "text"];
|
|
327
|
+
readonly traits: {};
|
|
328
|
+
};
|
|
329
|
+
inet: () => Expression.DbType.Base<"postgres", "inet"> & {
|
|
330
|
+
readonly family: "network";
|
|
331
|
+
readonly runtime: "string";
|
|
332
|
+
readonly compareGroup: "network";
|
|
333
|
+
readonly castTargets: readonly ["network", "text"];
|
|
334
|
+
readonly traits: {};
|
|
335
|
+
};
|
|
336
|
+
cidr: () => Expression.DbType.Base<"postgres", "cidr"> & {
|
|
337
|
+
readonly family: "network";
|
|
338
|
+
readonly runtime: "string";
|
|
339
|
+
readonly compareGroup: "network";
|
|
340
|
+
readonly castTargets: readonly ["network", "text"];
|
|
341
|
+
readonly traits: {};
|
|
342
|
+
};
|
|
343
|
+
macaddr: () => Expression.DbType.Base<"postgres", "macaddr"> & {
|
|
344
|
+
readonly family: "network";
|
|
345
|
+
readonly runtime: "string";
|
|
346
|
+
readonly compareGroup: "network";
|
|
347
|
+
readonly castTargets: readonly ["network", "text"];
|
|
348
|
+
readonly traits: {};
|
|
349
|
+
};
|
|
350
|
+
macaddr8: () => Expression.DbType.Base<"postgres", "macaddr8"> & {
|
|
351
|
+
readonly family: "network";
|
|
352
|
+
readonly runtime: "string";
|
|
353
|
+
readonly compareGroup: "network";
|
|
354
|
+
readonly castTargets: readonly ["network", "text"];
|
|
355
|
+
readonly traits: {};
|
|
356
|
+
};
|
|
357
|
+
point: () => Expression.DbType.Base<"postgres", "point"> & {
|
|
358
|
+
readonly family: "spatial";
|
|
359
|
+
readonly runtime: "unknown";
|
|
360
|
+
readonly compareGroup: "spatial";
|
|
361
|
+
readonly castTargets: readonly ["spatial", "text"];
|
|
362
|
+
readonly traits: {};
|
|
363
|
+
};
|
|
364
|
+
line: () => Expression.DbType.Base<"postgres", "line"> & {
|
|
365
|
+
readonly family: "spatial";
|
|
366
|
+
readonly runtime: "unknown";
|
|
367
|
+
readonly compareGroup: "spatial";
|
|
368
|
+
readonly castTargets: readonly ["spatial", "text"];
|
|
369
|
+
readonly traits: {};
|
|
370
|
+
};
|
|
371
|
+
lseg: () => Expression.DbType.Base<"postgres", "lseg"> & {
|
|
372
|
+
readonly family: "spatial";
|
|
373
|
+
readonly runtime: "unknown";
|
|
374
|
+
readonly compareGroup: "spatial";
|
|
375
|
+
readonly castTargets: readonly ["spatial", "text"];
|
|
376
|
+
readonly traits: {};
|
|
377
|
+
};
|
|
378
|
+
box: () => Expression.DbType.Base<"postgres", "box"> & {
|
|
379
|
+
readonly family: "spatial";
|
|
380
|
+
readonly runtime: "unknown";
|
|
381
|
+
readonly compareGroup: "spatial";
|
|
382
|
+
readonly castTargets: readonly ["spatial", "text"];
|
|
383
|
+
readonly traits: {};
|
|
384
|
+
};
|
|
385
|
+
path: () => Expression.DbType.Base<"postgres", "path"> & {
|
|
386
|
+
readonly family: "spatial";
|
|
387
|
+
readonly runtime: "unknown";
|
|
388
|
+
readonly compareGroup: "spatial";
|
|
389
|
+
readonly castTargets: readonly ["spatial", "text"];
|
|
390
|
+
readonly traits: {};
|
|
391
|
+
};
|
|
392
|
+
polygon: () => Expression.DbType.Base<"postgres", "polygon"> & {
|
|
393
|
+
readonly family: "spatial";
|
|
394
|
+
readonly runtime: "unknown";
|
|
395
|
+
readonly compareGroup: "spatial";
|
|
396
|
+
readonly castTargets: readonly ["spatial", "text"];
|
|
397
|
+
readonly traits: {};
|
|
398
|
+
};
|
|
399
|
+
circle: () => Expression.DbType.Base<"postgres", "circle"> & {
|
|
400
|
+
readonly family: "spatial";
|
|
401
|
+
readonly runtime: "unknown";
|
|
402
|
+
readonly compareGroup: "spatial";
|
|
403
|
+
readonly castTargets: readonly ["spatial", "text"];
|
|
404
|
+
readonly traits: {};
|
|
405
|
+
};
|
|
406
|
+
tsvector: () => Expression.DbType.Base<"postgres", "tsvector"> & {
|
|
407
|
+
readonly family: "textsearch";
|
|
408
|
+
readonly runtime: "string";
|
|
409
|
+
readonly compareGroup: "textsearch";
|
|
410
|
+
readonly castTargets: readonly ["textsearch", "text"];
|
|
411
|
+
readonly traits: {};
|
|
412
|
+
};
|
|
413
|
+
tsquery: () => Expression.DbType.Base<"postgres", "tsquery"> & {
|
|
414
|
+
readonly family: "textsearch";
|
|
415
|
+
readonly runtime: "string";
|
|
416
|
+
readonly compareGroup: "textsearch";
|
|
417
|
+
readonly castTargets: readonly ["textsearch", "text"];
|
|
418
|
+
readonly traits: {};
|
|
419
|
+
};
|
|
420
|
+
int4range: () => Expression.DbType.Base<"postgres", "int4range"> & {
|
|
421
|
+
readonly family: "range";
|
|
422
|
+
readonly runtime: "unknown";
|
|
423
|
+
readonly compareGroup: "range";
|
|
424
|
+
readonly castTargets: readonly ["range", "text"];
|
|
425
|
+
readonly traits: {};
|
|
426
|
+
};
|
|
427
|
+
int8range: () => Expression.DbType.Base<"postgres", "int8range"> & {
|
|
428
|
+
readonly family: "range";
|
|
429
|
+
readonly runtime: "unknown";
|
|
430
|
+
readonly compareGroup: "range";
|
|
431
|
+
readonly castTargets: readonly ["range", "text"];
|
|
432
|
+
readonly traits: {};
|
|
433
|
+
};
|
|
434
|
+
numrange: () => Expression.DbType.Base<"postgres", "numrange"> & {
|
|
435
|
+
readonly family: "range";
|
|
436
|
+
readonly runtime: "unknown";
|
|
437
|
+
readonly compareGroup: "range";
|
|
438
|
+
readonly castTargets: readonly ["range", "text"];
|
|
439
|
+
readonly traits: {};
|
|
440
|
+
};
|
|
441
|
+
tsrange: () => Expression.DbType.Base<"postgres", "tsrange"> & {
|
|
442
|
+
readonly family: "range";
|
|
443
|
+
readonly runtime: "unknown";
|
|
444
|
+
readonly compareGroup: "range";
|
|
445
|
+
readonly castTargets: readonly ["range", "text"];
|
|
446
|
+
readonly traits: {};
|
|
447
|
+
};
|
|
448
|
+
tstzrange: () => Expression.DbType.Base<"postgres", "tstzrange"> & {
|
|
449
|
+
readonly family: "range";
|
|
450
|
+
readonly runtime: "unknown";
|
|
451
|
+
readonly compareGroup: "range";
|
|
452
|
+
readonly castTargets: readonly ["range", "text"];
|
|
453
|
+
readonly traits: {};
|
|
454
|
+
};
|
|
455
|
+
daterange: () => Expression.DbType.Base<"postgres", "daterange"> & {
|
|
456
|
+
readonly family: "range";
|
|
457
|
+
readonly runtime: "unknown";
|
|
458
|
+
readonly compareGroup: "range";
|
|
459
|
+
readonly castTargets: readonly ["range", "text"];
|
|
460
|
+
readonly traits: {};
|
|
461
|
+
};
|
|
462
|
+
int4multirange: () => Expression.DbType.Base<"postgres", "int4multirange"> & {
|
|
463
|
+
readonly family: "multirange";
|
|
464
|
+
readonly runtime: "unknown";
|
|
465
|
+
readonly compareGroup: "multirange";
|
|
466
|
+
readonly castTargets: readonly ["multirange", "text"];
|
|
467
|
+
readonly traits: {};
|
|
468
|
+
};
|
|
469
|
+
int8multirange: () => Expression.DbType.Base<"postgres", "int8multirange"> & {
|
|
470
|
+
readonly family: "multirange";
|
|
471
|
+
readonly runtime: "unknown";
|
|
472
|
+
readonly compareGroup: "multirange";
|
|
473
|
+
readonly castTargets: readonly ["multirange", "text"];
|
|
474
|
+
readonly traits: {};
|
|
475
|
+
};
|
|
476
|
+
nummultirange: () => Expression.DbType.Base<"postgres", "nummultirange"> & {
|
|
477
|
+
readonly family: "multirange";
|
|
478
|
+
readonly runtime: "unknown";
|
|
479
|
+
readonly compareGroup: "multirange";
|
|
480
|
+
readonly castTargets: readonly ["multirange", "text"];
|
|
481
|
+
readonly traits: {};
|
|
482
|
+
};
|
|
483
|
+
tsmultirange: () => Expression.DbType.Base<"postgres", "tsmultirange"> & {
|
|
484
|
+
readonly family: "multirange";
|
|
485
|
+
readonly runtime: "unknown";
|
|
486
|
+
readonly compareGroup: "multirange";
|
|
487
|
+
readonly castTargets: readonly ["multirange", "text"];
|
|
488
|
+
readonly traits: {};
|
|
489
|
+
};
|
|
490
|
+
tstzmultirange: () => Expression.DbType.Base<"postgres", "tstzmultirange"> & {
|
|
491
|
+
readonly family: "multirange";
|
|
492
|
+
readonly runtime: "unknown";
|
|
493
|
+
readonly compareGroup: "multirange";
|
|
494
|
+
readonly castTargets: readonly ["multirange", "text"];
|
|
495
|
+
readonly traits: {};
|
|
496
|
+
};
|
|
497
|
+
datemultirange: () => Expression.DbType.Base<"postgres", "datemultirange"> & {
|
|
498
|
+
readonly family: "multirange";
|
|
499
|
+
readonly runtime: "unknown";
|
|
500
|
+
readonly compareGroup: "multirange";
|
|
501
|
+
readonly castTargets: readonly ["multirange", "text"];
|
|
502
|
+
readonly traits: {};
|
|
503
|
+
};
|
|
504
|
+
boolean: () => Expression.DbType.Base<"postgres", "bool"> & {
|
|
505
|
+
readonly family: "boolean";
|
|
506
|
+
readonly runtime: "boolean";
|
|
507
|
+
readonly compareGroup: "boolean";
|
|
508
|
+
readonly castTargets: readonly ["boolean", "text", "numeric"];
|
|
509
|
+
readonly traits: {};
|
|
510
|
+
};
|
|
511
|
+
json: () => Expression.DbType.Json<"postgres", "json">;
|
|
512
|
+
jsonb: () => Expression.DbType.Json<"postgres", "jsonb">;
|
|
513
|
+
};
|
|
514
|
+
export { postgresDatatypeFamilies, postgresDatatypeKinds };
|
|
515
|
+
export type PostgresDatatypeModule = typeof postgresDatatypes;
|
|
@@ -1,8 +1,52 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import
|
|
1
|
+
import type { DatatypeModule } from "../../internal/datatypes/define.js"
|
|
2
|
+
import type * as Expression from "../../internal/scalar.js"
|
|
3
|
+
import { postgresDatatypeFamilies, postgresDatatypeKinds } from "./spec.js"
|
|
3
4
|
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
5
|
+
const withMetadata = <Kind extends keyof typeof postgresDatatypeKinds & string>(
|
|
6
|
+
kind: Kind
|
|
7
|
+
): Expression.DbType.Base<"postgres", Kind> => {
|
|
8
|
+
const kindSpec = postgresDatatypeKinds[kind]
|
|
9
|
+
const familySpec = postgresDatatypeFamilies[kindSpec.family as keyof typeof postgresDatatypeFamilies]
|
|
10
|
+
return {
|
|
11
|
+
dialect: "postgres",
|
|
12
|
+
kind,
|
|
13
|
+
family: kindSpec.family,
|
|
14
|
+
runtime: kindSpec.runtime,
|
|
15
|
+
compareGroup: familySpec?.compareGroup,
|
|
16
|
+
castTargets: familySpec?.castTargets,
|
|
17
|
+
traits: familySpec?.traits
|
|
18
|
+
}
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
const postgresDatatypeModule = {
|
|
22
|
+
custom: (kind: string) => ({
|
|
23
|
+
dialect: "postgres",
|
|
24
|
+
kind
|
|
25
|
+
}),
|
|
26
|
+
boolean: () => withMetadata("bool")
|
|
27
|
+
} as Record<string, (...args: readonly any[]) => Expression.DbType.Base<"postgres", string>>
|
|
28
|
+
|
|
29
|
+
for (const kind of Object.keys(postgresDatatypeKinds)) {
|
|
30
|
+
postgresDatatypeModule[kind] = () => withMetadata(kind as keyof typeof postgresDatatypeKinds & string)
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
export const postgresDatatypes = {
|
|
34
|
+
...(postgresDatatypeModule as DatatypeModule<
|
|
35
|
+
"postgres",
|
|
36
|
+
typeof postgresDatatypeKinds,
|
|
37
|
+
typeof postgresDatatypeFamilies,
|
|
38
|
+
{ readonly boolean: "bool" }
|
|
39
|
+
>),
|
|
40
|
+
json: (): Expression.DbType.Json<"postgres", "json"> => ({
|
|
41
|
+
...withMetadata("json"),
|
|
42
|
+
variant: "json"
|
|
43
|
+
}),
|
|
44
|
+
jsonb: (): Expression.DbType.Json<"postgres", "jsonb"> => ({
|
|
45
|
+
...withMetadata("jsonb"),
|
|
46
|
+
variant: "jsonb"
|
|
47
|
+
})
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
export { postgresDatatypeFamilies, postgresDatatypeKinds }
|
|
7
51
|
|
|
8
52
|
export type PostgresDatatypeModule = typeof postgresDatatypes
|