rawsql-ts
Version:
[beta]High-performance SQL parser and AST analyzer written in TypeScript. Provides fast parsing and advanced transformation capabilities.
158 lines (157 loc) • 4.68 kB
TypeScript
import { SqlComponent } from "./SqlComponent";
import { QualifiedName, IdentifierString, ValueComponent, RawString } from "./ValueComponent";
import { TableConstraintDefinition } from "./CreateTableQuery";
export type DropBehavior = 'cascade' | 'restrict' | null;
export type IndexSortOrder = 'asc' | 'desc' | null;
export type IndexNullsOrder = 'first' | 'last' | null;
/**
* DROP TABLE statement representation.
*/
export declare class DropTableStatement extends SqlComponent {
static kind: symbol;
tables: QualifiedName[];
ifExists: boolean;
behavior: DropBehavior;
constructor(params: {
tables: QualifiedName[];
ifExists?: boolean;
behavior?: DropBehavior;
});
}
/**
* DROP INDEX statement representation.
*/
export declare class DropIndexStatement extends SqlComponent {
static kind: symbol;
indexNames: QualifiedName[];
ifExists: boolean;
concurrently: boolean;
behavior: DropBehavior;
constructor(params: {
indexNames: QualifiedName[];
ifExists?: boolean;
concurrently?: boolean;
behavior?: DropBehavior;
});
}
/**
* Column definition within CREATE INDEX clause.
*/
export declare class IndexColumnDefinition extends SqlComponent {
static kind: symbol;
expression: ValueComponent;
sortOrder: IndexSortOrder;
nullsOrder: IndexNullsOrder;
collation?: QualifiedName | null;
operatorClass?: QualifiedName | null;
constructor(params: {
expression: ValueComponent;
sortOrder?: IndexSortOrder;
nullsOrder?: IndexNullsOrder;
collation?: QualifiedName | null;
operatorClass?: QualifiedName | null;
});
}
/**
* CREATE INDEX statement representation.
*/
export declare class CreateIndexStatement extends SqlComponent {
static kind: symbol;
unique: boolean;
concurrently: boolean;
ifNotExists: boolean;
indexName: QualifiedName;
tableName: QualifiedName;
usingMethod?: IdentifierString | RawString | null;
columns: IndexColumnDefinition[];
include?: IdentifierString[] | null;
where?: ValueComponent;
withOptions?: RawString | null;
tablespace?: IdentifierString | null;
constructor(params: {
unique?: boolean;
concurrently?: boolean;
ifNotExists?: boolean;
indexName: QualifiedName;
tableName: QualifiedName;
usingMethod?: IdentifierString | RawString | null;
columns: IndexColumnDefinition[];
include?: IdentifierString[] | null;
where?: ValueComponent;
withOptions?: RawString | null;
tablespace?: IdentifierString | null;
});
}
/**
* ALTER TABLE ... ADD CONSTRAINT action.
*/
export declare class AlterTableAddConstraint extends SqlComponent {
static kind: symbol;
constraint: TableConstraintDefinition;
ifNotExists: boolean;
notValid: boolean;
constructor(params: {
constraint: TableConstraintDefinition;
ifNotExists?: boolean;
notValid?: boolean;
});
}
/**
* ALTER TABLE ... DROP CONSTRAINT action.
*/
export declare class AlterTableDropConstraint extends SqlComponent {
static kind: symbol;
constraintName: IdentifierString;
ifExists: boolean;
behavior: DropBehavior;
constructor(params: {
constraintName: IdentifierString;
ifExists?: boolean;
behavior?: DropBehavior;
});
}
/**
* ALTER TABLE ... DROP COLUMN action.
*/
export declare class AlterTableDropColumn extends SqlComponent {
static kind: symbol;
columnName: IdentifierString;
ifExists: boolean;
behavior: DropBehavior;
constructor(params: {
columnName: IdentifierString;
ifExists?: boolean;
behavior?: DropBehavior;
});
}
export type AlterTableAction = AlterTableAddConstraint | AlterTableDropConstraint | AlterTableDropColumn;
/**
* ALTER TABLE statement representation with constraint-centric actions.
*/
export declare class AlterTableStatement extends SqlComponent {
static kind: symbol;
table: QualifiedName;
only: boolean;
ifExists: boolean;
actions: AlterTableAction[];
constructor(params: {
table: QualifiedName;
only?: boolean;
ifExists?: boolean;
actions: AlterTableAction[];
});
}
/**
* Standalone DROP CONSTRAINT statement representation.
*/
export declare class DropConstraintStatement extends SqlComponent {
static kind: symbol;
constraintName: IdentifierString;
ifExists: boolean;
behavior: DropBehavior;
constructor(params: {
constraintName: IdentifierString;
ifExists?: boolean;
behavior?: DropBehavior;
});
}