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 | export type DataType = string | AbstractDataTypeConstructor | AbstractDataType;
|
49 |
|
50 | export const ABSTRACT: AbstractDataTypeConstructor;
|
51 |
|
52 | interface AbstractDataTypeConstructor {
|
53 | key: string;
|
54 | warn(link: string, text: string): void;
|
55 | new (): AbstractDataType;
|
56 | (): AbstractDataType;
|
57 | }
|
58 |
|
59 | export interface AbstractDataType {
|
60 | key: string;
|
61 | dialectTypes: string;
|
62 | toSql(): string;
|
63 | stringify(value: unknown, options?: object): string;
|
64 | toString(options: object): string;
|
65 | }
|
66 |
|
67 |
|
68 |
|
69 |
|
70 | export const STRING: StringDataTypeConstructor;
|
71 |
|
72 | interface StringDataTypeConstructor extends AbstractDataTypeConstructor {
|
73 | new (length?: number, binary?: boolean): StringDataType;
|
74 | new (options?: StringDataTypeOptions): StringDataType;
|
75 | (length?: number, binary?: boolean): StringDataType;
|
76 | (options?: StringDataTypeOptions): StringDataType;
|
77 | }
|
78 |
|
79 | export interface StringDataType extends AbstractDataType {
|
80 | options?: StringDataTypeOptions;
|
81 | BINARY: this;
|
82 | validate(value: unknown): boolean;
|
83 | }
|
84 |
|
85 | export interface StringDataTypeOptions {
|
86 | length?: number;
|
87 | binary?: boolean;
|
88 | }
|
89 |
|
90 |
|
91 |
|
92 |
|
93 | export const CHAR: CharDataTypeConstructor;
|
94 |
|
95 | interface CharDataTypeConstructor extends StringDataTypeConstructor {
|
96 | new (length?: number, binary?: boolean): CharDataType;
|
97 | new (options?: CharDataTypeOptions): CharDataType;
|
98 | (length?: number, binary?: boolean): CharDataType;
|
99 | (options?: CharDataTypeOptions): CharDataType;
|
100 | }
|
101 |
|
102 | export interface CharDataType extends StringDataType {
|
103 | options: CharDataTypeOptions;
|
104 | }
|
105 |
|
106 | export interface CharDataTypeOptions extends StringDataTypeOptions {}
|
107 |
|
108 | export type TextLength = 'tiny' | 'medium' | 'long';
|
109 |
|
110 |
|
111 |
|
112 |
|
113 | export const TEXT: TextDataTypeConstructor;
|
114 |
|
115 | interface TextDataTypeConstructor extends AbstractDataTypeConstructor {
|
116 | new (length?: TextLength): TextDataType;
|
117 | new (options?: TextDataTypeOptions): TextDataType;
|
118 | (length?: TextLength): TextDataType;
|
119 | (options?: TextDataTypeOptions): TextDataType;
|
120 | }
|
121 |
|
122 | export interface TextDataType extends AbstractDataType {
|
123 | options: TextDataTypeOptions;
|
124 | validate(value: unknown): boolean;
|
125 | }
|
126 |
|
127 | export interface TextDataTypeOptions {
|
128 | length?: TextLength;
|
129 | }
|
130 |
|
131 | export const NUMBER: NumberDataTypeConstructor;
|
132 |
|
133 | interface NumberDataTypeConstructor extends AbstractDataTypeConstructor {
|
134 | options: NumberDataTypeOptions;
|
135 | UNSIGNED: this;
|
136 | ZEROFILL: this;
|
137 | new (options?: NumberDataTypeOptions): NumberDataType;
|
138 | (options?: NumberDataTypeOptions): NumberDataType;
|
139 | validate(value: unknown): boolean;
|
140 | }
|
141 |
|
142 | export interface NumberDataType extends AbstractDataType {
|
143 | options: NumberDataTypeOptions;
|
144 | UNSIGNED: this;
|
145 | ZEROFILL: this;
|
146 | validate(value: unknown): boolean;
|
147 | }
|
148 |
|
149 | export interface IntegerDataTypeOptions {
|
150 | length?: number;
|
151 | zerofill?: boolean;
|
152 | unsigned?: boolean;
|
153 | }
|
154 | export interface NumberDataTypeOptions extends IntegerDataTypeOptions {
|
155 | decimals?: number;
|
156 | precision?: number;
|
157 | scale?: number;
|
158 | }
|
159 |
|
160 |
|
161 |
|
162 |
|
163 | export const TINYINT: TinyIntegerDataTypeConstructor;
|
164 |
|
165 | interface TinyIntegerDataTypeConstructor extends NumberDataTypeConstructor {
|
166 | new (options?: IntegerDataTypeOptions): TinyIntegerDataType;
|
167 | (options?: IntegerDataTypeOptions): TinyIntegerDataType;
|
168 | }
|
169 |
|
170 | export interface TinyIntegerDataType extends NumberDataType {
|
171 | options: IntegerDataTypeOptions;
|
172 | }
|
173 |
|
174 |
|
175 |
|
176 |
|
177 | export const SMALLINT: SmallIntegerDataTypeConstructor;
|
178 |
|
179 | interface SmallIntegerDataTypeConstructor extends NumberDataTypeConstructor {
|
180 | new (options?: IntegerDataTypeOptions): SmallIntegerDataType;
|
181 | (options?: IntegerDataTypeOptions): SmallIntegerDataType;
|
182 | }
|
183 |
|
184 | export interface SmallIntegerDataType extends NumberDataType {
|
185 | options: IntegerDataTypeOptions;
|
186 | }
|
187 |
|
188 |
|
189 |
|
190 |
|
191 | export const MEDIUMINT: MediumIntegerDataTypeConstructor;
|
192 |
|
193 | interface MediumIntegerDataTypeConstructor extends NumberDataTypeConstructor {
|
194 | new (options?: IntegerDataTypeOptions): MediumIntegerDataType;
|
195 | (options?: IntegerDataTypeOptions): MediumIntegerDataType;
|
196 | }
|
197 |
|
198 | export interface MediumIntegerDataType extends NumberDataType {
|
199 | options: IntegerDataTypeOptions;
|
200 | }
|
201 |
|
202 |
|
203 |
|
204 |
|
205 | export const INTEGER: IntegerDataTypeConstructor;
|
206 |
|
207 | interface IntegerDataTypeConstructor extends NumberDataTypeConstructor {
|
208 | new (options?: NumberDataTypeOptions): IntegerDataType;
|
209 | (options?: NumberDataTypeOptions): IntegerDataType;
|
210 | }
|
211 |
|
212 | export interface IntegerDataType extends NumberDataType {
|
213 | options: NumberDataTypeOptions;
|
214 | }
|
215 |
|
216 |
|
217 |
|
218 |
|
219 |
|
220 |
|
221 |
|
222 | export const BIGINT: BigIntDataTypeConstructor;
|
223 |
|
224 | interface BigIntDataTypeConstructor extends NumberDataTypeConstructor {
|
225 | new (options?: IntegerDataTypeOptions): BigIntDataType;
|
226 | (options?: IntegerDataTypeOptions): BigIntDataType;
|
227 | }
|
228 |
|
229 | export interface BigIntDataType extends NumberDataType {
|
230 | options: IntegerDataTypeOptions;
|
231 | }
|
232 |
|
233 |
|
234 |
|
235 |
|
236 | export const FLOAT: FloatDataTypeConstructor;
|
237 |
|
238 | interface FloatDataTypeConstructor extends NumberDataTypeConstructor {
|
239 | new (length?: number, decimals?: number): FloatDataType;
|
240 | new (options?: FloatDataTypeOptions): FloatDataType;
|
241 | (length?: number, decimals?: number): FloatDataType;
|
242 | (options?: FloatDataTypeOptions): FloatDataType;
|
243 | }
|
244 |
|
245 | export interface FloatDataType extends NumberDataType {
|
246 | options: FloatDataTypeOptions;
|
247 | }
|
248 |
|
249 | export interface FloatDataTypeOptions {
|
250 | length?: number;
|
251 | decimals?: number;
|
252 | }
|
253 |
|
254 |
|
255 |
|
256 |
|
257 | export const REAL: RealDataTypeConstructor;
|
258 |
|
259 | interface RealDataTypeConstructor extends NumberDataTypeConstructor {
|
260 | new (length?: number, decimals?: number): RealDataType;
|
261 | new (options?: RealDataTypeOptions): RealDataType;
|
262 | (length?: number, decimals?: number): RealDataType;
|
263 | (options?: RealDataTypeOptions): RealDataType;
|
264 | }
|
265 |
|
266 | export interface RealDataType extends NumberDataType {
|
267 | options: RealDataTypeOptions;
|
268 | }
|
269 |
|
270 | export interface RealDataTypeOptions {
|
271 | length?: number;
|
272 | decimals?: number;
|
273 | }
|
274 |
|
275 |
|
276 |
|
277 |
|
278 | export const DOUBLE: DoubleDataTypeConstructor;
|
279 |
|
280 | interface DoubleDataTypeConstructor extends NumberDataTypeConstructor {
|
281 | new (length?: number, decimals?: number): DoubleDataType;
|
282 | new (options?: DoubleDataTypeOptions): DoubleDataType;
|
283 | (length?: number, decimals?: number): DoubleDataType;
|
284 | (options?: DoubleDataTypeOptions): DoubleDataType;
|
285 | }
|
286 |
|
287 | export interface DoubleDataType extends NumberDataType {
|
288 | options: DoubleDataTypeOptions;
|
289 | }
|
290 |
|
291 | export interface DoubleDataTypeOptions {
|
292 | length?: number;
|
293 | decimals?: number;
|
294 | }
|
295 |
|
296 |
|
297 |
|
298 |
|
299 | export const DECIMAL: DecimalDataTypeConstructor;
|
300 |
|
301 | interface DecimalDataTypeConstructor extends NumberDataTypeConstructor {
|
302 | PRECISION: this;
|
303 | SCALE: this;
|
304 | new (precision?: number, scale?: number): DecimalDataType;
|
305 | new (options?: DecimalDataTypeOptions): DecimalDataType;
|
306 | (precision?: number, scale?: number): DecimalDataType;
|
307 | (options?: DecimalDataTypeOptions): DecimalDataType;
|
308 | }
|
309 |
|
310 | export interface DecimalDataType extends NumberDataType {
|
311 | options: DecimalDataTypeOptions;
|
312 | }
|
313 |
|
314 | export interface DecimalDataTypeOptions {
|
315 | precision?: number;
|
316 | scale?: number;
|
317 | }
|
318 |
|
319 |
|
320 |
|
321 |
|
322 | export const BOOLEAN: AbstractDataTypeConstructor;
|
323 |
|
324 |
|
325 |
|
326 |
|
327 | export const TIME: AbstractDataTypeConstructor;
|
328 |
|
329 |
|
330 |
|
331 |
|
332 | export const DATE: DateDataTypeConstructor;
|
333 |
|
334 | interface DateDataTypeConstructor extends AbstractDataTypeConstructor {
|
335 | new (length?: string | number): DateDataType;
|
336 | new (options?: DateDataTypeOptions): DateDataType;
|
337 | (length?: string | number): DateDataType;
|
338 | (options?: DateDataTypeOptions): DateDataType;
|
339 | }
|
340 |
|
341 | export interface DateDataType extends AbstractDataType {
|
342 | options: DateDataTypeOptions;
|
343 | }
|
344 |
|
345 | export interface DateDataTypeOptions {
|
346 | length?: string | number;
|
347 | }
|
348 |
|
349 |
|
350 |
|
351 |
|
352 | export const DATEONLY: DateOnlyDataTypeConstructor;
|
353 |
|
354 | interface DateOnlyDataTypeConstructor extends AbstractDataTypeConstructor {
|
355 | new (): DateOnlyDataType;
|
356 | (): DateOnlyDataType;
|
357 | }
|
358 |
|
359 | export interface DateOnlyDataType extends AbstractDataType {
|
360 | }
|
361 |
|
362 |
|
363 |
|
364 |
|
365 |
|
366 | export const HSTORE: AbstractDataTypeConstructor;
|
367 |
|
368 |
|
369 |
|
370 |
|
371 | export const JSON: AbstractDataTypeConstructor;
|
372 |
|
373 |
|
374 |
|
375 | export const JSONB: AbstractDataTypeConstructor;
|
376 |
|
377 |
|
378 |
|
379 |
|
380 | export const NOW: AbstractDataTypeConstructor;
|
381 |
|
382 |
|
383 |
|
384 |
|
385 | export const BLOB: BlobDataTypeConstructor;
|
386 |
|
387 | export type BlobSize = 'tiny' | 'medium' | 'long';
|
388 |
|
389 | interface BlobDataTypeConstructor extends AbstractDataTypeConstructor {
|
390 | new (length?: BlobSize): BlobDataType;
|
391 | new (options?: BlobDataTypeOptions): BlobDataType;
|
392 | (length?: BlobSize): BlobDataType;
|
393 | (options?: BlobDataTypeOptions): BlobDataType;
|
394 | }
|
395 |
|
396 | export interface BlobDataType extends AbstractDataType {
|
397 | options: BlobDataTypeOptions;
|
398 | escape: boolean;
|
399 | }
|
400 |
|
401 | export interface BlobDataTypeOptions {
|
402 | length?: BlobSize;
|
403 | escape?: boolean;
|
404 | }
|
405 |
|
406 |
|
407 |
|
408 |
|
409 |
|
410 |
|
411 |
|
412 | export const RANGE: RangeDataTypeConstructor;
|
413 |
|
414 | export type RangeableDataType =
|
415 | | IntegerDataTypeConstructor
|
416 | | IntegerDataType
|
417 | | BigIntDataTypeConstructor
|
418 | | BigIntDataType
|
419 | | DecimalDataTypeConstructor
|
420 | | DecimalDataType
|
421 | | DateOnlyDataTypeConstructor
|
422 | | DateOnlyDataType
|
423 | | DateDataTypeConstructor
|
424 | | DateDataType;
|
425 |
|
426 | interface RangeDataTypeConstructor extends AbstractDataTypeConstructor {
|
427 | new <T extends RangeableDataType>(subtype?: T): RangeDataType<T>;
|
428 | new <T extends RangeableDataType>(options: RangeDataTypeOptions<T>): RangeDataType<T>;
|
429 | <T extends RangeableDataType>(subtype?: T): RangeDataType<T>;
|
430 | <T extends RangeableDataType>(options: RangeDataTypeOptions<T>): RangeDataType<T>;
|
431 | }
|
432 |
|
433 | export interface RangeDataType<T extends RangeableDataType> extends AbstractDataType {
|
434 | options: RangeDataTypeOptions<T>;
|
435 | }
|
436 |
|
437 | export interface RangeDataTypeOptions<T extends RangeableDataType> {
|
438 | subtype?: T;
|
439 | }
|
440 |
|
441 |
|
442 |
|
443 |
|
444 | export const UUID: AbstractDataTypeConstructor;
|
445 |
|
446 |
|
447 |
|
448 |
|
449 | export const UUIDV1: AbstractDataTypeConstructor;
|
450 |
|
451 |
|
452 |
|
453 |
|
454 | export const UUIDV4: AbstractDataTypeConstructor;
|
455 |
|
456 |
|
457 |
|
458 |
|
459 |
|
460 |
|
461 |
|
462 |
|
463 |
|
464 |
|
465 |
|
466 |
|
467 |
|
468 |
|
469 |
|
470 |
|
471 |
|
472 |
|
473 |
|
474 |
|
475 |
|
476 |
|
477 |
|
478 |
|
479 |
|
480 |
|
481 |
|
482 |
|
483 |
|
484 |
|
485 |
|
486 |
|
487 |
|
488 |
|
489 |
|
490 |
|
491 |
|
492 |
|
493 |
|
494 |
|
495 |
|
496 |
|
497 | export const VIRTUAL: VirtualDataTypeConstructor;
|
498 |
|
499 | interface VirtualDataTypeConstructor extends AbstractDataTypeConstructor {
|
500 | new <T extends AbstractDataTypeConstructor | AbstractDataType>(ReturnType: T, fields?: string[]): VirtualDataType<
|
501 | T
|
502 | >;
|
503 | <T extends AbstractDataTypeConstructor | AbstractDataType>(ReturnType: T, fields?: string[]): VirtualDataType<T>;
|
504 | }
|
505 |
|
506 | export interface VirtualDataType<T extends AbstractDataTypeConstructor | AbstractDataType> extends AbstractDataType {
|
507 | returnType: T;
|
508 | fields: string[];
|
509 | }
|
510 |
|
511 |
|
512 |
|
513 |
|
514 | export const ENUM: EnumDataTypeConstructor;
|
515 |
|
516 | interface EnumDataTypeConstructor extends AbstractDataTypeConstructor {
|
517 | new <T extends string>(...values: T[]): EnumDataType<T>;
|
518 | new <T extends string>(options: EnumDataTypeOptions<T>): EnumDataType<T>;
|
519 | <T extends string>(...values: T[]): EnumDataType<T>;
|
520 | <T extends string>(options: EnumDataTypeOptions<T>): EnumDataType<T>;
|
521 | }
|
522 |
|
523 | export interface EnumDataType<T extends string> extends AbstractDataType {
|
524 | values: T[];
|
525 | options: EnumDataTypeOptions<T>;
|
526 | }
|
527 |
|
528 | export interface EnumDataTypeOptions<T extends string> {
|
529 | values: T[];
|
530 | }
|
531 |
|
532 |
|
533 |
|
534 |
|
535 | export const ARRAY: ArrayDataTypeConstructor;
|
536 |
|
537 | interface ArrayDataTypeConstructor extends AbstractDataTypeConstructor {
|
538 | new <T extends AbstractDataTypeConstructor | AbstractDataType>(type: T): ArrayDataType<T>;
|
539 | new <T extends AbstractDataTypeConstructor | AbstractDataType>(options: ArrayDataTypeOptions<T>): ArrayDataType<T>;
|
540 | <T extends AbstractDataTypeConstructor | AbstractDataType>(type: T): ArrayDataType<T>;
|
541 | <T extends AbstractDataTypeConstructor | AbstractDataType>(options: ArrayDataTypeOptions<T>): ArrayDataType<T>;
|
542 | is<T extends AbstractDataTypeConstructor | AbstractDataType>(obj: unknown, type: T): obj is ArrayDataType<T>;
|
543 | }
|
544 |
|
545 | export interface ArrayDataType<T extends AbstractDataTypeConstructor | AbstractDataType> extends AbstractDataType {
|
546 | options: ArrayDataTypeOptions<T>;
|
547 | }
|
548 |
|
549 | export interface ArrayDataTypeOptions<T extends AbstractDataTypeConstructor | AbstractDataType> {
|
550 | type: T;
|
551 | }
|
552 |
|
553 |
|
554 |
|
555 |
|
556 | export const GEOMETRY: GeometryDataTypeConstructor;
|
557 |
|
558 | interface GeometryDataTypeConstructor extends AbstractDataTypeConstructor {
|
559 | new (type: string, srid?: number): GeometryDataType;
|
560 | new (options: GeometryDataTypeOptions): GeometryDataType;
|
561 | (type: string, srid?: number): GeometryDataType;
|
562 | (options: GeometryDataTypeOptions): GeometryDataType;
|
563 | }
|
564 |
|
565 | export interface GeometryDataType extends AbstractDataType {
|
566 | options: GeometryDataTypeOptions;
|
567 | type: string;
|
568 | srid?: number;
|
569 | escape: boolean;
|
570 | }
|
571 |
|
572 | export interface GeometryDataTypeOptions {
|
573 | type: string;
|
574 | srid?: number;
|
575 | }
|
576 |
|
577 |
|
578 |
|
579 |
|
580 | export const GEOGRAPHY: GeographyDataTypeConstructor;
|
581 |
|
582 | interface GeographyDataTypeConstructor extends AbstractDataTypeConstructor {
|
583 | new (type: string, srid?: number): GeographyDataType;
|
584 | new (options: GeographyDataTypeOptions): GeographyDataType;
|
585 | (type: string, srid?: number): GeographyDataType;
|
586 | (options: GeographyDataTypeOptions): GeographyDataType;
|
587 | }
|
588 |
|
589 | export interface GeographyDataType extends AbstractDataType {
|
590 | options: GeographyDataTypeOptions;
|
591 | type: string;
|
592 | srid?: number;
|
593 | escape: boolean;
|
594 | }
|
595 |
|
596 | export interface GeographyDataTypeOptions {
|
597 | type: string;
|
598 | srid?: number;
|
599 | }
|
600 |
|
601 | export const CIDR: AbstractDataTypeConstructor;
|
602 |
|
603 | export const INET: AbstractDataTypeConstructor;
|
604 |
|
605 | export const MACADDR: AbstractDataTypeConstructor;
|
606 |
|
607 |
|
608 |
|
609 |
|
610 | export const CITEXT: AbstractDataTypeConstructor;
|
611 |
|
612 |
|
613 |
|
614 |
|
615 | export const TSVECTOR: AbstractDataTypeConstructor;
|
616 |
|
617 |
|
618 | export type DataTypeAbstract = AbstractDataTypeConstructor;
|