|
1 | | -import { ColumnDef, ColumnOption, CommentDef, DataType, GeneratedAs, NullsDistinctOption, SqlOption } from "./data-type"; |
| 1 | +import { ColumnDef, ColumnOption, CommentDef, ConstraintCharacteristics, DataType, GeneratedAs, NullsDistinctOption, ReferentialAction, SequenceOptions, SqlOption } from "./data-type"; |
2 | 2 | import type { Expr, ExprWithAlias, OneOrManyWithParens } from "./expr"; |
3 | | -import { FunctionArg, SQLFunction } from "./function"; |
| 3 | +import { FunctionArg, NamedWindowDefinition, SQLFunction } from "./function"; |
4 | 4 | import type { Ident, ObjectName, ObjectType } from "./ident"; |
5 | 5 | import type { AttachedToken, Value, ValueWithSpan } from "./token"; |
6 | 6 |
|
@@ -515,23 +515,7 @@ export type AlterColumnOperation = |
515 | 515 | }, |
516 | 516 | } |
517 | 517 |
|
518 | | -/** |
519 | | - * ```sql |
520 | | - * [ INCREMENT [ BY ] increment ] |
521 | | - [ MINVALUE minvalue | NO MINVALUE ] [ MAXVALUE maxvalue | NO MAXVALUE ] |
522 | | - [ START [ WITH ] start ] [ CACHE cache ] [ [ NO ] CYCLE ] |
523 | | - ``` |
524 | | - * |
525 | | - * @see https://docs.rs/sqlparser/latest/sqlparser/ast/enum.SequenceOptions.html |
526 | | - */ |
527 | | -export type SequenceOptions = { |
528 | | - IncrementBy?: [Expr, boolean], |
529 | | - MinValue?: Expr, |
530 | | - MaxValue?: Expr, |
531 | | - StartWith?: [Expr, boolean], |
532 | | - Cache?: Expr, |
533 | | - Cycle?: boolean, |
534 | | -} |
| 518 | + |
535 | 519 |
|
536 | 520 | /** |
537 | 521 | * SQL `CREATE TABLE` statement. |
@@ -751,49 +735,6 @@ export type FileFormat = |
751 | 735 | | 'RCFILE' |
752 | 736 | | 'JSONFILE'; |
753 | 737 |
|
754 | | -/** |
755 | | - * `<constraint_characteristics> = [ DEFERRABLE | NOT DEFERRABLE ] [ INITIALLY DEFERRED | INITIALLY IMMEDIATE ] [ ENFORCED | NOT ENFORCED ]` |
756 | | - * |
757 | | - * Used in UNIQUE and foreign key constraints. The individual settings may occur in any order. |
758 | | - * |
759 | | - * @see https://docs.rs/sqlparser/latest/sqlparser/ast/struct.ConstraintCharacteristics.html |
760 | | - */ |
761 | | -export interface ConstraintCharacteristics { |
762 | | - /** |
763 | | - * `[ DEFERRABLE | NOT DEFERRABLE ]` |
764 | | - */ |
765 | | - deferrable?: boolean, |
766 | | - |
767 | | - /** |
768 | | - * `[ INITIALLY DEFERRED | INITIALLY IMMEDIATE ]` |
769 | | - */ |
770 | | - initially?: DeferrableInitial, |
771 | | - |
772 | | - /** |
773 | | - * `[ ENFORCED | NOT ENFORCED ]` |
774 | | - */ |
775 | | - enforced?: boolean, |
776 | | -} |
777 | | - |
778 | | -/** |
779 | | - * @see https://docs.rs/sqlparser/latest/sqlparser/ast/enum.DeferrableInitial.html |
780 | | - */ |
781 | | -export type DeferrableInitial = 'Immediate' | 'Deferred'; |
782 | | - |
783 | | -/** |
784 | | - * `<referential_action> = { RESTRICT | CASCADE | SET NULL | NO ACTION | SET DEFAULT }` |
785 | | - * |
786 | | - * Used in foreign key constraints in ON UPDATE and ON DELETE options. |
787 | | - * |
788 | | - * @see https://docs.rs/sqlparser/latest/sqlparser/ast/enum.ReferentialAction.html |
789 | | - */ |
790 | | -export type ReferentialAction = |
791 | | - | 'Restrict' |
792 | | - | 'Cascade' |
793 | | - | 'SetNull' |
794 | | - | 'NoAction' |
795 | | - | 'SetDefault'; |
796 | | - |
797 | 738 | /** |
798 | 739 | * Representation whether a definition can can contains the KEY or INDEX keywords with the same meaning. |
799 | 740 | * |
@@ -1900,45 +1841,6 @@ export type GroupByWithModifier = 'Rollup' | 'Cube' | 'Totals' | { |
1900 | 1841 | GroupingSets: Expr; |
1901 | 1842 | } |
1902 | 1843 |
|
1903 | | -/** |
1904 | | - * @see https://docs.rs/sqlparser/latest/sqlparser/ast/struct.NamedWindowDefinition.html |
1905 | | - */ |
1906 | | -export type NamedWindowDefinition = [Ident, NamedWindowExpr]; |
1907 | | - |
1908 | | -/** |
1909 | | - * An expression used in a named window declaration. |
1910 | | - * |
1911 | | - * `WINDOW mywindow AS [named_window_expr]` |
1912 | | - * |
1913 | | - * @see https://docs.rs/sqlparser/latest/sqlparser/ast/enum.NamedWindowExpr.html |
1914 | | - */ |
1915 | | -export type NamedWindowExpr = { |
1916 | | - NamedWindow?: Ident; |
1917 | | - WindowSpec?: WindowSpec; |
1918 | | -}; |
1919 | | - |
1920 | | -/** |
1921 | | - * A window specification (i.e. `OVER ([window_name] PARTITION BY .. ORDER BY .. etc.)`) |
1922 | | - * |
1923 | | - * @see https://docs.rs/sqlparser/latest/sqlparser/ast/struct.WindowSpec.html |
1924 | | - */ |
1925 | | -export interface WindowSpec { |
1926 | | - window_name?: Ident, |
1927 | | - partition_by: Expr[], |
1928 | | - order_by: OrderByExpr[], |
1929 | | - window_frame?: WindowFrame, |
1930 | | -} |
1931 | | - |
1932 | | -/** |
1933 | | - * @see https://docs.rs/sqlparser/latest/sqlparser/ast/struct.WindowFrame.html |
1934 | | - */ |
1935 | | -export interface WindowFrame { |
1936 | | - // TODO: Define proper types |
1937 | | - units: unknown; |
1938 | | - start_bound: unknown; |
1939 | | - end_bound?: unknown; |
1940 | | -} |
1941 | | - |
1942 | 1844 | /** |
1943 | 1845 | * What did this select look like? |
1944 | 1846 | * |
|
0 commit comments