forked from jawj/zapatos
-
Notifications
You must be signed in to change notification settings - Fork 0
/
schema.ts
215 lines (197 loc) · 9.69 KB
/
schema.ts
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
/*
Zapatos: https://jawj.github.io/zapatos/
Copyright (C) 2020 George MacKerron
Released under the MIT licence: see LICENCE file
*/
// this schema describes the system tables/views that we interrogate to generate the user's schema
// it is NOT auto-generated, since data on system tables doesn't show up in system tables!
import type {
GenericSQLExpression,
ColumnNames,
ColumnValues,
ParentColumn,
DefaultType,
} from "./src";
export declare namespace pg_indexes {
export type Table = "pg_indexes";
export interface Selectable {
indexname: string;
tablename: string;
}
export interface Insertable extends Selectable { }
export interface Updatable extends Partial<Insertable> { }
export type Whereable = { [K in keyof Insertable]?: Exclude<Insertable[K] | ParentColumn, null | DefaultType> };
export type UniqueIndex = never;
export type Column = keyof Selectable;
export type OnlyCols<T extends readonly Column[]> = Pick<Selectable, T[number]>;
export type SQLExpression = GenericSQLExpression | Table | Whereable | Column | ColumnNames<Updatable | (keyof Updatable)[]> | ColumnValues<Updatable>;
export type SQL = SQLExpression | SQLExpression[];
}
export declare namespace pg_class {
export type Table = "pg_class";
export interface Selectable {
oid: number;
relname: string;
}
export interface Insertable extends Selectable { }
export interface Updatable extends Partial<Insertable> { }
export type Whereable = { [K in keyof Insertable]?: Exclude<Insertable[K] | ParentColumn, null | DefaultType> };
export type UniqueIndex = never;
export type Column = keyof Selectable;
export type OnlyCols<T extends readonly Column[]> = Pick<Selectable, T[number]>;
export type SQLExpression = GenericSQLExpression | Table | Whereable | Column | ColumnNames<Updatable | (keyof Updatable)[]> | ColumnValues<Updatable>;
export type SQL = SQLExpression | SQLExpression[];
}
export declare namespace pg_index {
export type Table = "pg_index";
export interface Selectable {
indexrelid: number;
indisunique: boolean;
}
export interface Insertable extends Selectable { }
export interface Updatable extends Partial<Insertable> { }
export type Whereable = { [K in keyof Insertable]?: Exclude<Insertable[K] | ParentColumn, null | DefaultType> };
export type UniqueIndex = never;
export type Column = keyof Selectable;
export type OnlyCols<T extends readonly Column[]> = Pick<Selectable, T[number]>;
export type SQLExpression = GenericSQLExpression | Table | Whereable | Column | ColumnNames<Updatable | (keyof Updatable)[]> | ColumnValues<Updatable>;
export type SQL = SQLExpression | SQLExpression[];
}
export declare namespace pg_type {
export type Table = "pg_type";
export interface Selectable {
typname: string;
typnamespace: string;
}
export interface Insertable extends Selectable { }
export interface Updatable extends Partial<Insertable> { }
export type Whereable = { [K in keyof Insertable]?: Exclude<Insertable[K] | ParentColumn, null | DefaultType> };
export type UniqueIndex = never;
export type Column = keyof Selectable;
export type OnlyCols<T extends readonly Column[]> = Pick<Selectable, T[number]>;
export type SQLExpression = GenericSQLExpression | Table | Whereable | Column | ColumnNames<Updatable | (keyof Updatable)[]> | ColumnValues<Updatable>;
export type SQL = SQLExpression | SQLExpression[];
}
export declare namespace pg_enum {
export type Table = "pg_enum";
export interface Selectable {
enumtypid: number;
enumlabel: string;
}
export interface Insertable extends Selectable { }
export interface Updatable extends Partial<Insertable> { }
export type Whereable = { [K in keyof Insertable]?: Exclude<Insertable[K] | ParentColumn, null | DefaultType> };
export type UniqueIndex = never;
export type Column = keyof Selectable;
export type OnlyCols<T extends readonly Column[]> = Pick<Selectable, T[number]>;
export type SQLExpression = GenericSQLExpression | Table | Whereable | Column | ColumnNames<Updatable | (keyof Updatable)[]> | ColumnValues<Updatable>;
export type SQL = SQLExpression | SQLExpression[];
}
export declare namespace pg_namespace {
export type Table = "pg_namespace";
export interface Selectable {
oid: number;
nspname: string;
}
export interface Insertable extends Selectable { }
export interface Updatable extends Partial<Insertable> { }
export type Whereable = { [K in keyof Insertable]?: Exclude<Insertable[K] | ParentColumn, null | DefaultType> };
export type UniqueIndex = never;
export type Column = keyof Selectable;
export type OnlyCols<T extends readonly Column[]> = Pick<Selectable, T[number]>;
export type SQLExpression = GenericSQLExpression | Table | Whereable | Column | ColumnNames<Updatable | (keyof Updatable)[]> | ColumnValues<Updatable>;
export type SQL = SQLExpression | SQLExpression[];
}
export declare namespace information_schema.columns { // eslint-disable-line @typescript-eslint/no-unused-vars
export type Table = '"information_schema"."columns"';
export interface Selectable {
table_name: string;
table_schema: string;
column_name: string;
udt_name: string;
domain_name: string;
is_nullable: 'YES' | 'NO';
column_default: string;
is_identity: 'YES' | 'NO';
is_generated: 'ALWAYS' | 'NEVER';
}
export interface Insertable extends Selectable { }
export interface Updatable extends Partial<Insertable> { }
export type Whereable = { [K in keyof Insertable]?: Exclude<Insertable[K] | ParentColumn, null | DefaultType> };
export type UniqueIndex = never;
export type Column = keyof Selectable;
export type OnlyCols<T extends readonly Column[]> = Pick<Selectable, T[number]>;
export type SQLExpression = GenericSQLExpression | Table | Whereable | Column | ColumnNames<Updatable | (keyof Updatable)[]> | ColumnValues<Updatable>;
export type SQL = SQLExpression | SQLExpression[];
}
export type Selectable = pg_indexes.Selectable | pg_class.Selectable | pg_index.Selectable | pg_type.Selectable | pg_enum.Selectable | pg_namespace.Selectable | information_schema.columns.Selectable;
export type Whereable = pg_indexes.Whereable | pg_class.Whereable | pg_index.Whereable | pg_type.Whereable | pg_enum.Whereable | pg_namespace.Whereable | information_schema.columns.Whereable;
export type Insertable = pg_indexes.Insertable | pg_class.Insertable | pg_index.Insertable | pg_type.Insertable | pg_enum.Insertable | pg_namespace.Insertable | information_schema.columns.Insertable;
export type Updatable = pg_indexes.Updatable | pg_class.Updatable | pg_index.Updatable | pg_type.Updatable | pg_enum.Updatable | pg_namespace.Updatable | information_schema.columns.Updatable;
export type Table = pg_indexes.Table | pg_class.Table | pg_index.Table | pg_type.Table | pg_enum.Table | pg_namespace.Table | information_schema.columns.Table;
export type UniqueIndex = pg_indexes.UniqueIndex | pg_class.UniqueIndex | pg_index.UniqueIndex | pg_type.UniqueIndex | pg_enum.UniqueIndex | pg_namespace.UniqueIndex | information_schema.columns.UniqueIndex;
export type Column = pg_indexes.Column | pg_class.Column | pg_index.Column | pg_type.Column | pg_enum.Column | pg_namespace.Column | information_schema.columns.Column;
export type AllTables = [pg_type.Table, pg_enum.Table, pg_namespace.Table, information_schema.columns.Table];
export type SelectableForTable<T extends Table> = {
pg_indexes: pg_indexes.Selectable;
pg_class: pg_class.Selectable;
pg_index: pg_index.Selectable;
pg_type: pg_type.Selectable;
pg_enum: pg_enum.Selectable;
pg_namespace: pg_namespace.Selectable;
'"information_schema"."columns"': information_schema.columns.Selectable;
}[T];
export type WhereableForTable<T extends Table> = {
pg_indexes: pg_indexes.Whereable;
pg_class: pg_class.Whereable;
pg_index: pg_index.Whereable;
pg_type: pg_type.Whereable;
pg_enum: pg_enum.Whereable;
pg_namespace: pg_namespace.Whereable;
'"information_schema"."columns"': information_schema.columns.Whereable;
}[T];
export type InsertableForTable<T extends Table> = {
pg_indexes: pg_indexes.Insertable;
pg_class: pg_class.Insertable;
pg_index: pg_index.Insertable;
pg_type: pg_type.Insertable;
pg_enum: pg_enum.Insertable;
pg_namespace: pg_namespace.Insertable;
'"information_schema"."columns"': information_schema.columns.Insertable;
}[T];
export type UpdatableForTable<T extends Table> = {
pg_indexes: pg_indexes.Updatable;
pg_class: pg_class.Updatable;
pg_index: pg_index.Updatable;
pg_type: pg_type.Updatable;
pg_enum: pg_enum.Updatable;
pg_namespace: pg_namespace.Updatable;
'"information_schema"."columns"': information_schema.columns.Updatable;
}[T];
export type UniqueIndexForTable<T extends Table> = {
pg_indexes: pg_indexes.UniqueIndex;
pg_class: pg_class.UniqueIndex;
pg_index: pg_index.UniqueIndex;
pg_type: pg_type.UniqueIndex;
pg_enum: pg_enum.UniqueIndex;
pg_namespace: pg_namespace.UniqueIndex;
'"information_schema"."columns"': information_schema.columns.UniqueIndex;
}[T];
export type ColumnForTable<T extends Table> = {
pg_indexes: pg_indexes.Column;
pg_class: pg_class.Column;
pg_index: pg_index.Column;
pg_type: pg_type.Column;
pg_enum: pg_enum.Column;
pg_namespace: pg_namespace.Column;
'"information_schema"."columns"': information_schema.columns.Column;
}[T];
export type SQLForTable<T extends Table> = {
pg_indexes: pg_indexes.SQL;
pg_class: pg_class.SQL;
pg_index: pg_index.SQL;
pg_type: pg_type.SQL;
pg_enum: pg_enum.SQL;
pg_namespace: pg_namespace.SQL;
'"information_schema"."columns"': information_schema.columns.SQL;
}[T];