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