effect-qb 0.12.3
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 +1294 -0
- package/dist/mysql.js +57575 -0
- package/dist/postgres.js +6303 -0
- package/package.json +42 -0
- package/src/internal/aggregation-validation.ts +57 -0
- package/src/internal/case-analysis.ts +50 -0
- package/src/internal/coercion-analysis.ts +30 -0
- package/src/internal/coercion-errors.ts +29 -0
- package/src/internal/coercion-kind.ts +32 -0
- package/src/internal/coercion-normalize.ts +7 -0
- package/src/internal/coercion-rules.ts +25 -0
- package/src/internal/column-state.ts +453 -0
- package/src/internal/column.ts +417 -0
- package/src/internal/datatypes/define.ts +44 -0
- package/src/internal/datatypes/lookup.ts +280 -0
- package/src/internal/datatypes/shape.ts +72 -0
- package/src/internal/derived-table.ts +149 -0
- package/src/internal/dialect.ts +30 -0
- package/src/internal/executor.ts +390 -0
- package/src/internal/expression-ast.ts +349 -0
- package/src/internal/expression.ts +325 -0
- package/src/internal/grouping-key.ts +82 -0
- package/src/internal/json/ast.ts +63 -0
- package/src/internal/json/errors.ts +13 -0
- package/src/internal/json/path.ts +227 -0
- package/src/internal/json/shape.ts +1 -0
- package/src/internal/json/types.ts +386 -0
- package/src/internal/mysql-dialect.ts +39 -0
- package/src/internal/mysql-renderer.ts +37 -0
- package/src/internal/plan.ts +64 -0
- package/src/internal/postgres-dialect.ts +34 -0
- package/src/internal/postgres-renderer.ts +40 -0
- package/src/internal/predicate-analysis.ts +71 -0
- package/src/internal/predicate-atom.ts +43 -0
- package/src/internal/predicate-branches.ts +40 -0
- package/src/internal/predicate-context.ts +279 -0
- package/src/internal/predicate-formula.ts +100 -0
- package/src/internal/predicate-key.ts +28 -0
- package/src/internal/predicate-nnf.ts +12 -0
- package/src/internal/predicate-normalize.ts +202 -0
- package/src/internal/projection-alias.ts +15 -0
- package/src/internal/projections.ts +101 -0
- package/src/internal/query-ast.ts +297 -0
- package/src/internal/query-factory.ts +6757 -0
- package/src/internal/query-requirements.ts +40 -0
- package/src/internal/query.ts +1590 -0
- package/src/internal/renderer.ts +102 -0
- package/src/internal/runtime-normalize.ts +344 -0
- package/src/internal/runtime-schema.ts +428 -0
- package/src/internal/runtime-value.ts +85 -0
- package/src/internal/schema-derivation.ts +131 -0
- package/src/internal/sql-expression-renderer.ts +1353 -0
- package/src/internal/table-options.ts +225 -0
- package/src/internal/table.ts +674 -0
- package/src/mysql/column.ts +30 -0
- package/src/mysql/datatypes/index.ts +6 -0
- package/src/mysql/datatypes/spec.ts +180 -0
- package/src/mysql/errors/catalog.ts +51662 -0
- package/src/mysql/errors/fields.ts +21 -0
- package/src/mysql/errors/index.ts +18 -0
- package/src/mysql/errors/normalize.ts +232 -0
- package/src/mysql/errors/requirements.ts +73 -0
- package/src/mysql/executor.ts +134 -0
- package/src/mysql/query.ts +189 -0
- package/src/mysql/renderer.ts +19 -0
- package/src/mysql/table.ts +157 -0
- package/src/mysql.ts +18 -0
- package/src/postgres/column.ts +20 -0
- package/src/postgres/datatypes/index.ts +8 -0
- package/src/postgres/datatypes/spec.ts +264 -0
- package/src/postgres/errors/catalog.ts +452 -0
- package/src/postgres/errors/fields.ts +48 -0
- package/src/postgres/errors/index.ts +4 -0
- package/src/postgres/errors/normalize.ts +209 -0
- package/src/postgres/errors/requirements.ts +65 -0
- package/src/postgres/errors/types.ts +38 -0
- package/src/postgres/executor.ts +131 -0
- package/src/postgres/query.ts +189 -0
- package/src/postgres/renderer.ts +29 -0
- package/src/postgres/table.ts +157 -0
- package/src/postgres.ts +18 -0
|
@@ -0,0 +1,157 @@
|
|
|
1
|
+
import type * as Schema from "effect/Schema"
|
|
2
|
+
|
|
3
|
+
import type * as Expression from "../internal/expression.js"
|
|
4
|
+
import { ColumnTypeId, type AnyColumnDefinition } from "../internal/column-state.js"
|
|
5
|
+
import * as BaseTable from "../internal/table.js"
|
|
6
|
+
|
|
7
|
+
type Dialect = "mysql"
|
|
8
|
+
|
|
9
|
+
type DialectColumn = AnyColumnDefinition & {
|
|
10
|
+
readonly [ColumnTypeId]: {
|
|
11
|
+
readonly dbType: Expression.DbType.Any & { readonly dialect: Dialect }
|
|
12
|
+
}
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
type DialectFieldMap = Record<string, DialectColumn>
|
|
16
|
+
|
|
17
|
+
type InlinePrimaryKeyKeys<Fields extends DialectFieldMap> = Extract<{
|
|
18
|
+
[K in keyof Fields]: Fields[K]["metadata"]["primaryKey"] extends true ? K : never
|
|
19
|
+
}[keyof Fields], string>
|
|
20
|
+
|
|
21
|
+
export type TableDefinition<
|
|
22
|
+
Name extends string,
|
|
23
|
+
Fields extends DialectFieldMap,
|
|
24
|
+
PrimaryKeyColumns extends keyof Fields & string = InlinePrimaryKeyKeys<Fields>,
|
|
25
|
+
Kind extends "schema" | "alias" = "schema",
|
|
26
|
+
SchemaName extends string | undefined = undefined
|
|
27
|
+
> = BaseTable.TableDefinition<Name, Fields, PrimaryKeyColumns, Kind, SchemaName>
|
|
28
|
+
|
|
29
|
+
export type TableClassStatic<
|
|
30
|
+
Name extends string,
|
|
31
|
+
Fields extends DialectFieldMap,
|
|
32
|
+
PrimaryKeyColumns extends keyof Fields & string = InlinePrimaryKeyKeys<Fields>,
|
|
33
|
+
SchemaName extends string | undefined = undefined
|
|
34
|
+
> = BaseTable.TableClassStatic<Name, Fields, PrimaryKeyColumns, SchemaName>
|
|
35
|
+
|
|
36
|
+
export type AnyTable = BaseTable.AnyTable
|
|
37
|
+
|
|
38
|
+
type FieldsOfTable<Table> = Table extends BaseTable.TableDefinition<any, infer Fields extends DialectFieldMap, any, any, any>
|
|
39
|
+
? Fields
|
|
40
|
+
: Table extends BaseTable.TableClassStatic<any, infer Fields extends DialectFieldMap, any, any>
|
|
41
|
+
? Fields
|
|
42
|
+
: never
|
|
43
|
+
|
|
44
|
+
type PrimaryKeyOfTable<Table> = Table extends BaseTable.TableDefinition<any, any, infer PrimaryKeyColumns extends string, any, any>
|
|
45
|
+
? PrimaryKeyColumns
|
|
46
|
+
: Table extends BaseTable.TableClassStatic<any, any, infer PrimaryKeyColumns extends string, any>
|
|
47
|
+
? PrimaryKeyColumns
|
|
48
|
+
: never
|
|
49
|
+
|
|
50
|
+
type SchemaNameOfTable<Table> = Table extends BaseTable.TableDefinition<any, any, any, any, infer SchemaName>
|
|
51
|
+
? SchemaName
|
|
52
|
+
: Table extends BaseTable.TableClassStatic<any, any, any, infer SchemaName>
|
|
53
|
+
? SchemaName
|
|
54
|
+
: never
|
|
55
|
+
|
|
56
|
+
export type TableSchemaNamespace<SchemaName extends string> = {
|
|
57
|
+
readonly schemaName: SchemaName
|
|
58
|
+
readonly table: <
|
|
59
|
+
Name extends string,
|
|
60
|
+
Fields extends DialectFieldMap,
|
|
61
|
+
PrimaryKeyColumns extends keyof Fields & string = InlinePrimaryKeyKeys<Fields>
|
|
62
|
+
>(
|
|
63
|
+
name: Name,
|
|
64
|
+
fields: Fields,
|
|
65
|
+
...options: BaseTable.DeclaredTableOptions
|
|
66
|
+
) => TableDefinition<Name, Fields, PrimaryKeyColumns, "schema", SchemaName>
|
|
67
|
+
}
|
|
68
|
+
|
|
69
|
+
export type TableOption = BaseTable.TableOption
|
|
70
|
+
|
|
71
|
+
export const TypeId = BaseTable.TypeId
|
|
72
|
+
export const OptionsSymbol = BaseTable.OptionsSymbol
|
|
73
|
+
export const options = BaseTable.options
|
|
74
|
+
|
|
75
|
+
export const make = <
|
|
76
|
+
Name extends string,
|
|
77
|
+
Fields extends DialectFieldMap,
|
|
78
|
+
SchemaName extends string | undefined = undefined
|
|
79
|
+
>(
|
|
80
|
+
name: Name,
|
|
81
|
+
fields: Fields,
|
|
82
|
+
schemaName: SchemaName = undefined as SchemaName
|
|
83
|
+
): TableDefinition<Name, Fields> =>
|
|
84
|
+
BaseTable.make(name, fields, schemaName) as TableDefinition<Name, Fields>
|
|
85
|
+
|
|
86
|
+
export const schema = <SchemaName extends string>(
|
|
87
|
+
schemaName: SchemaName
|
|
88
|
+
): TableSchemaNamespace<SchemaName> => ({
|
|
89
|
+
schemaName,
|
|
90
|
+
table: <
|
|
91
|
+
Name extends string,
|
|
92
|
+
Fields extends DialectFieldMap,
|
|
93
|
+
PrimaryKeyColumns extends keyof Fields & string = InlinePrimaryKeyKeys<Fields>
|
|
94
|
+
>(
|
|
95
|
+
name: Name,
|
|
96
|
+
fields: Fields,
|
|
97
|
+
...declaredOptions: BaseTable.DeclaredTableOptions
|
|
98
|
+
) =>
|
|
99
|
+
BaseTable.schema(schemaName).table(
|
|
100
|
+
name,
|
|
101
|
+
fields,
|
|
102
|
+
...declaredOptions
|
|
103
|
+
) as TableDefinition<Name, Fields, PrimaryKeyColumns, "schema", SchemaName>
|
|
104
|
+
})
|
|
105
|
+
|
|
106
|
+
export const alias = <
|
|
107
|
+
Table extends AnyTable,
|
|
108
|
+
AliasName extends string
|
|
109
|
+
>(
|
|
110
|
+
table: Table,
|
|
111
|
+
aliasName: AliasName
|
|
112
|
+
): TableDefinition<
|
|
113
|
+
AliasName,
|
|
114
|
+
FieldsOfTable<Table>,
|
|
115
|
+
PrimaryKeyOfTable<Table>,
|
|
116
|
+
"alias",
|
|
117
|
+
SchemaNameOfTable<Table>
|
|
118
|
+
> =>
|
|
119
|
+
BaseTable.alias(table as any, aliasName) as TableDefinition<
|
|
120
|
+
AliasName,
|
|
121
|
+
FieldsOfTable<Table>,
|
|
122
|
+
PrimaryKeyOfTable<Table>,
|
|
123
|
+
"alias",
|
|
124
|
+
SchemaNameOfTable<Table>
|
|
125
|
+
>
|
|
126
|
+
|
|
127
|
+
export const Class = <Self = never, SchemaName extends string | undefined = undefined>(
|
|
128
|
+
name: string,
|
|
129
|
+
schemaName: SchemaName = undefined as SchemaName
|
|
130
|
+
) => {
|
|
131
|
+
const base = BaseTable.Class<Self, SchemaName>(name, schemaName)
|
|
132
|
+
return base as unknown as <
|
|
133
|
+
Fields extends DialectFieldMap
|
|
134
|
+
>(fields: Fields) => [Self] extends [never]
|
|
135
|
+
? BaseTable.MissingSelfGeneric
|
|
136
|
+
: TableClassStatic<typeof name, Fields, InlinePrimaryKeyKeys<Fields>, SchemaName>
|
|
137
|
+
}
|
|
138
|
+
|
|
139
|
+
export const primaryKey = BaseTable.primaryKey
|
|
140
|
+
export const unique = BaseTable.unique
|
|
141
|
+
export const index = BaseTable.index
|
|
142
|
+
export const foreignKey = <
|
|
143
|
+
LocalColumns extends string | readonly string[],
|
|
144
|
+
TargetTable extends AnyTable,
|
|
145
|
+
TargetColumns extends string | readonly string[]
|
|
146
|
+
>(
|
|
147
|
+
columns: LocalColumns,
|
|
148
|
+
target: () => TargetTable,
|
|
149
|
+
referencedColumns: TargetColumns
|
|
150
|
+
): BaseTable.TableOption =>
|
|
151
|
+
BaseTable.foreignKey(columns, target as () => BaseTable.AnyTable, referencedColumns)
|
|
152
|
+
|
|
153
|
+
export const check = BaseTable.check
|
|
154
|
+
|
|
155
|
+
export type SelectOf<Table extends { readonly schemas: { readonly select: Schema.Schema<any> } }> = BaseTable.SelectOf<Table>
|
|
156
|
+
export type InsertOf<Table extends { readonly schemas: { readonly insert: Schema.Schema<any> } }> = BaseTable.InsertOf<Table>
|
|
157
|
+
export type UpdateOf<Table extends { readonly schemas: { readonly update: Schema.Schema<any> } }> = BaseTable.UpdateOf<Table>
|
package/src/mysql.ts
ADDED
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
/** MySQL-specialized column-definition DSL. */
|
|
2
|
+
export * as Column from "./mysql/column.js"
|
|
3
|
+
/** MySQL datatype witnesses and coercion families. */
|
|
4
|
+
export * as Datatypes from "./mysql/datatypes/index.js"
|
|
5
|
+
/** MySQL error catalog and error normalization helpers. */
|
|
6
|
+
export * as Errors from "./mysql/errors/index.js"
|
|
7
|
+
/** Shared scalar SQL expression interfaces and DB-type descriptors. */
|
|
8
|
+
export * as Expression from "./internal/expression.js"
|
|
9
|
+
/** MySQL-specialized typed query execution contracts. */
|
|
10
|
+
export * as Executor from "./mysql/executor.js"
|
|
11
|
+
/** Shared logical query-plan interfaces. */
|
|
12
|
+
export * as Plan from "./internal/plan.js"
|
|
13
|
+
/** MySQL-specialized query-construction DSL. */
|
|
14
|
+
export * as Query from "./mysql/query.js"
|
|
15
|
+
/** MySQL-specialized table-definition DSL. */
|
|
16
|
+
export * as Table from "./mysql/table.js"
|
|
17
|
+
/** MySQL-specialized built-in renderer entrypoint. */
|
|
18
|
+
export * as Renderer from "./mysql/renderer.js"
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
export {
|
|
2
|
+
boolean,
|
|
3
|
+
date,
|
|
4
|
+
generated,
|
|
5
|
+
hasDefault,
|
|
6
|
+
int,
|
|
7
|
+
json,
|
|
8
|
+
nullable,
|
|
9
|
+
number,
|
|
10
|
+
primaryKey,
|
|
11
|
+
references,
|
|
12
|
+
schema,
|
|
13
|
+
text,
|
|
14
|
+
timestamp,
|
|
15
|
+
custom,
|
|
16
|
+
unique,
|
|
17
|
+
uuid
|
|
18
|
+
} from "../internal/column.js"
|
|
19
|
+
|
|
20
|
+
export type { Any, AnyBound } from "../internal/column.js"
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { makeDatatypeModule } from "../../internal/datatypes/define.js"
|
|
2
|
+
import { postgresDatatypeKinds } from "./spec.js"
|
|
3
|
+
|
|
4
|
+
export const postgresDatatypes = makeDatatypeModule("postgres", postgresDatatypeKinds, {
|
|
5
|
+
boolean: "bool"
|
|
6
|
+
})
|
|
7
|
+
|
|
8
|
+
export type PostgresDatatypeModule = typeof postgresDatatypes
|
|
@@ -0,0 +1,264 @@
|
|
|
1
|
+
import type { DatatypeFamilySpec, DatatypeKindSpec } from "../../internal/datatypes/shape.js"
|
|
2
|
+
|
|
3
|
+
export const postgresDatatypeFamilies = {
|
|
4
|
+
text: {
|
|
5
|
+
compareGroup: "text",
|
|
6
|
+
castTargets: [
|
|
7
|
+
"text",
|
|
8
|
+
"numeric",
|
|
9
|
+
"boolean",
|
|
10
|
+
"date",
|
|
11
|
+
"time",
|
|
12
|
+
"timestamp",
|
|
13
|
+
"interval",
|
|
14
|
+
"binary",
|
|
15
|
+
"uuid",
|
|
16
|
+
"json",
|
|
17
|
+
"xml",
|
|
18
|
+
"bit",
|
|
19
|
+
"oid",
|
|
20
|
+
"identifier",
|
|
21
|
+
"network",
|
|
22
|
+
"spatial",
|
|
23
|
+
"textsearch",
|
|
24
|
+
"range",
|
|
25
|
+
"multirange",
|
|
26
|
+
"array",
|
|
27
|
+
"money",
|
|
28
|
+
"null"
|
|
29
|
+
],
|
|
30
|
+
traits: {
|
|
31
|
+
textual: true,
|
|
32
|
+
ordered: true
|
|
33
|
+
}
|
|
34
|
+
},
|
|
35
|
+
numeric: {
|
|
36
|
+
compareGroup: "numeric",
|
|
37
|
+
castTargets: ["numeric", "text", "boolean", "date", "time", "timestamp", "interval", "uuid", "bit", "oid", "money"],
|
|
38
|
+
traits: {
|
|
39
|
+
ordered: true
|
|
40
|
+
}
|
|
41
|
+
},
|
|
42
|
+
boolean: {
|
|
43
|
+
compareGroup: "boolean",
|
|
44
|
+
castTargets: ["boolean", "text", "numeric"],
|
|
45
|
+
traits: {}
|
|
46
|
+
},
|
|
47
|
+
date: {
|
|
48
|
+
compareGroup: "date",
|
|
49
|
+
castTargets: ["date", "timestamp", "text"],
|
|
50
|
+
traits: {
|
|
51
|
+
ordered: true
|
|
52
|
+
}
|
|
53
|
+
},
|
|
54
|
+
time: {
|
|
55
|
+
compareGroup: "time",
|
|
56
|
+
castTargets: ["time", "timestamp", "text"],
|
|
57
|
+
traits: {
|
|
58
|
+
ordered: true
|
|
59
|
+
}
|
|
60
|
+
},
|
|
61
|
+
timestamp: {
|
|
62
|
+
compareGroup: "timestamp",
|
|
63
|
+
castTargets: ["timestamp", "date", "text"],
|
|
64
|
+
traits: {
|
|
65
|
+
ordered: true
|
|
66
|
+
}
|
|
67
|
+
},
|
|
68
|
+
interval: {
|
|
69
|
+
compareGroup: "interval",
|
|
70
|
+
castTargets: ["interval", "text"],
|
|
71
|
+
traits: {
|
|
72
|
+
ordered: true
|
|
73
|
+
}
|
|
74
|
+
},
|
|
75
|
+
binary: {
|
|
76
|
+
compareGroup: "binary",
|
|
77
|
+
castTargets: ["binary", "text"],
|
|
78
|
+
traits: {}
|
|
79
|
+
},
|
|
80
|
+
uuid: {
|
|
81
|
+
compareGroup: "uuid",
|
|
82
|
+
castTargets: ["uuid", "text"],
|
|
83
|
+
traits: {
|
|
84
|
+
ordered: true
|
|
85
|
+
}
|
|
86
|
+
},
|
|
87
|
+
json: {
|
|
88
|
+
compareGroup: "json",
|
|
89
|
+
castTargets: ["json", "text"],
|
|
90
|
+
traits: {}
|
|
91
|
+
},
|
|
92
|
+
xml: {
|
|
93
|
+
compareGroup: "xml",
|
|
94
|
+
castTargets: ["xml", "text"],
|
|
95
|
+
traits: {}
|
|
96
|
+
},
|
|
97
|
+
bit: {
|
|
98
|
+
compareGroup: "bit",
|
|
99
|
+
castTargets: ["bit", "text", "numeric"],
|
|
100
|
+
traits: {}
|
|
101
|
+
},
|
|
102
|
+
oid: {
|
|
103
|
+
compareGroup: "oid",
|
|
104
|
+
castTargets: ["oid", "text", "numeric"],
|
|
105
|
+
traits: {
|
|
106
|
+
ordered: true
|
|
107
|
+
}
|
|
108
|
+
},
|
|
109
|
+
identifier: {
|
|
110
|
+
compareGroup: "identifier",
|
|
111
|
+
castTargets: ["identifier", "text"],
|
|
112
|
+
traits: {}
|
|
113
|
+
},
|
|
114
|
+
network: {
|
|
115
|
+
compareGroup: "network",
|
|
116
|
+
castTargets: ["network", "text"],
|
|
117
|
+
traits: {}
|
|
118
|
+
},
|
|
119
|
+
spatial: {
|
|
120
|
+
compareGroup: "spatial",
|
|
121
|
+
castTargets: ["spatial", "text"],
|
|
122
|
+
traits: {}
|
|
123
|
+
},
|
|
124
|
+
textsearch: {
|
|
125
|
+
compareGroup: "textsearch",
|
|
126
|
+
castTargets: ["textsearch", "text"],
|
|
127
|
+
traits: {}
|
|
128
|
+
},
|
|
129
|
+
range: {
|
|
130
|
+
compareGroup: "range",
|
|
131
|
+
castTargets: ["range", "text"],
|
|
132
|
+
traits: {}
|
|
133
|
+
},
|
|
134
|
+
multirange: {
|
|
135
|
+
compareGroup: "multirange",
|
|
136
|
+
castTargets: ["multirange", "text"],
|
|
137
|
+
traits: {}
|
|
138
|
+
},
|
|
139
|
+
enum: {
|
|
140
|
+
compareGroup: "enum",
|
|
141
|
+
castTargets: ["enum", "text"],
|
|
142
|
+
traits: {
|
|
143
|
+
textual: true,
|
|
144
|
+
ordered: true
|
|
145
|
+
}
|
|
146
|
+
},
|
|
147
|
+
record: {
|
|
148
|
+
compareGroup: "record",
|
|
149
|
+
castTargets: ["record", "text"],
|
|
150
|
+
traits: {}
|
|
151
|
+
},
|
|
152
|
+
array: {
|
|
153
|
+
compareGroup: "array",
|
|
154
|
+
castTargets: ["array", "text"],
|
|
155
|
+
traits: {}
|
|
156
|
+
},
|
|
157
|
+
money: {
|
|
158
|
+
compareGroup: "money",
|
|
159
|
+
castTargets: ["money", "text", "numeric"],
|
|
160
|
+
traits: {
|
|
161
|
+
ordered: true
|
|
162
|
+
}
|
|
163
|
+
},
|
|
164
|
+
null: {
|
|
165
|
+
compareGroup: "null",
|
|
166
|
+
castTargets: [
|
|
167
|
+
"text",
|
|
168
|
+
"numeric",
|
|
169
|
+
"boolean",
|
|
170
|
+
"date",
|
|
171
|
+
"time",
|
|
172
|
+
"timestamp",
|
|
173
|
+
"interval",
|
|
174
|
+
"binary",
|
|
175
|
+
"uuid",
|
|
176
|
+
"json",
|
|
177
|
+
"xml",
|
|
178
|
+
"bit",
|
|
179
|
+
"oid",
|
|
180
|
+
"identifier",
|
|
181
|
+
"network",
|
|
182
|
+
"spatial",
|
|
183
|
+
"textsearch",
|
|
184
|
+
"range",
|
|
185
|
+
"multirange",
|
|
186
|
+
"array",
|
|
187
|
+
"money",
|
|
188
|
+
"null"
|
|
189
|
+
],
|
|
190
|
+
traits: {}
|
|
191
|
+
}
|
|
192
|
+
} as const satisfies Record<string, DatatypeFamilySpec>
|
|
193
|
+
|
|
194
|
+
export const postgresDatatypeKinds = {
|
|
195
|
+
text: { family: "text", runtime: "string" },
|
|
196
|
+
varchar: { family: "text", runtime: "string" },
|
|
197
|
+
char: { family: "text", runtime: "string" },
|
|
198
|
+
citext: { family: "text", runtime: "string" },
|
|
199
|
+
name: { family: "text", runtime: "string" },
|
|
200
|
+
uuid: { family: "uuid", runtime: "string" },
|
|
201
|
+
int2: { family: "numeric", runtime: "number" },
|
|
202
|
+
int4: { family: "numeric", runtime: "number" },
|
|
203
|
+
int8: { family: "numeric", runtime: "bigintString" },
|
|
204
|
+
numeric: { family: "numeric", runtime: "decimalString" },
|
|
205
|
+
float4: { family: "numeric", runtime: "number" },
|
|
206
|
+
float8: { family: "numeric", runtime: "number" },
|
|
207
|
+
money: { family: "money", runtime: "number" },
|
|
208
|
+
bool: { family: "boolean", runtime: "boolean" },
|
|
209
|
+
date: { family: "date", runtime: "localDate" },
|
|
210
|
+
time: { family: "time", runtime: "localTime" },
|
|
211
|
+
timetz: { family: "time", runtime: "offsetTime" },
|
|
212
|
+
timestamp: { family: "timestamp", runtime: "localDateTime" },
|
|
213
|
+
timestamptz: { family: "timestamp", runtime: "instant" },
|
|
214
|
+
interval: { family: "interval", runtime: "string" },
|
|
215
|
+
bytea: { family: "binary", runtime: "bytes" },
|
|
216
|
+
json: { family: "json", runtime: "json" },
|
|
217
|
+
jsonb: { family: "json", runtime: "json" },
|
|
218
|
+
xml: { family: "xml", runtime: "string" },
|
|
219
|
+
bit: { family: "bit", runtime: "string" },
|
|
220
|
+
varbit: { family: "bit", runtime: "string" },
|
|
221
|
+
oid: { family: "oid", runtime: "number" },
|
|
222
|
+
xid: { family: "oid", runtime: "number" },
|
|
223
|
+
xid8: { family: "oid", runtime: "bigintString" },
|
|
224
|
+
cid: { family: "oid", runtime: "number" },
|
|
225
|
+
tid: { family: "identifier", runtime: "string" },
|
|
226
|
+
regclass: { family: "identifier", runtime: "string" },
|
|
227
|
+
regtype: { family: "identifier", runtime: "string" },
|
|
228
|
+
regproc: { family: "identifier", runtime: "string" },
|
|
229
|
+
regprocedure: { family: "identifier", runtime: "string" },
|
|
230
|
+
regoper: { family: "identifier", runtime: "string" },
|
|
231
|
+
regoperator: { family: "identifier", runtime: "string" },
|
|
232
|
+
regconfig: { family: "identifier", runtime: "string" },
|
|
233
|
+
regdictionary: { family: "identifier", runtime: "string" },
|
|
234
|
+
pg_lsn: { family: "identifier", runtime: "string" },
|
|
235
|
+
txid_snapshot: { family: "identifier", runtime: "string" },
|
|
236
|
+
inet: { family: "network", runtime: "string" },
|
|
237
|
+
cidr: { family: "network", runtime: "string" },
|
|
238
|
+
macaddr: { family: "network", runtime: "string" },
|
|
239
|
+
macaddr8: { family: "network", runtime: "string" },
|
|
240
|
+
point: { family: "spatial", runtime: "unknown" },
|
|
241
|
+
line: { family: "spatial", runtime: "unknown" },
|
|
242
|
+
lseg: { family: "spatial", runtime: "unknown" },
|
|
243
|
+
box: { family: "spatial", runtime: "unknown" },
|
|
244
|
+
path: { family: "spatial", runtime: "unknown" },
|
|
245
|
+
polygon: { family: "spatial", runtime: "unknown" },
|
|
246
|
+
circle: { family: "spatial", runtime: "unknown" },
|
|
247
|
+
tsvector: { family: "textsearch", runtime: "string" },
|
|
248
|
+
tsquery: { family: "textsearch", runtime: "string" },
|
|
249
|
+
int4range: { family: "range", runtime: "unknown" },
|
|
250
|
+
int8range: { family: "range", runtime: "unknown" },
|
|
251
|
+
numrange: { family: "range", runtime: "unknown" },
|
|
252
|
+
tsrange: { family: "range", runtime: "unknown" },
|
|
253
|
+
tstzrange: { family: "range", runtime: "unknown" },
|
|
254
|
+
daterange: { family: "range", runtime: "unknown" },
|
|
255
|
+
int4multirange: { family: "multirange", runtime: "unknown" },
|
|
256
|
+
int8multirange: { family: "multirange", runtime: "unknown" },
|
|
257
|
+
nummultirange: { family: "multirange", runtime: "unknown" },
|
|
258
|
+
tsmultirange: { family: "multirange", runtime: "unknown" },
|
|
259
|
+
tstzmultirange: { family: "multirange", runtime: "unknown" },
|
|
260
|
+
datemultirange: { family: "multirange", runtime: "unknown" }
|
|
261
|
+
} as const satisfies Record<string, DatatypeKindSpec>
|
|
262
|
+
|
|
263
|
+
export type PostgresDatatypeFamily = keyof typeof postgresDatatypeFamilies
|
|
264
|
+
export type PostgresDatatypeKind = keyof typeof postgresDatatypeKinds
|