flink-sql-language-server
Version:
A LSP-based language server for Apache Flink SQL
126 lines (125 loc) • 3.38 kB
TypeScript
export declare enum SchemaNodeKind {
CATALOG = "catalog",
DATABASE = "database",
TABLE = "table",
VIEW = "view",
COLUMN = "column",
FUNCTION = "function"
}
export declare type RegisterSchemaMode = 'set' | 'patch';
interface SchemaBaseNode {
kind: SchemaNodeKind;
label: string;
description?: string;
}
export interface SchemaCatalog extends SchemaBaseNode {
kind: SchemaNodeKind.CATALOG;
default?: boolean;
}
export interface SchemaDatabase extends SchemaBaseNode {
kind: SchemaNodeKind.DATABASE;
catalog: string;
default?: boolean;
}
export interface SchemaTable extends SchemaBaseNode {
kind: SchemaNodeKind.TABLE;
database: string;
catalog: string;
}
export interface SchemaTableColumn extends SchemaBaseNode {
kind: SchemaNodeKind.COLUMN;
table: string;
database: string;
catalog: string;
}
export interface SchemaView extends SchemaBaseNode {
kind: SchemaNodeKind.VIEW;
database: string;
catalog: string;
}
export interface SchemaFunction extends SchemaBaseNode {
kind: SchemaNodeKind.FUNCTION;
database: string;
catalog: string;
}
declare type SchemaNode = SchemaCatalog | SchemaDatabase | SchemaTable | SchemaTableColumn | SchemaView | SchemaFunction;
export interface CatalogRegisterParams {
label: string;
description?: string;
default?: boolean;
}
export interface DatabaseRegisterParams {
catalog: string;
label: string;
description?: string;
default?: boolean;
}
export interface TableRegisterParams {
catalog: string;
database: string;
label: string;
description?: string;
}
export interface ColumnRegisterParams {
catalog: string;
database: string;
table: string;
label: string;
description?: string;
}
export interface ViewRegisterParams {
catalog: string;
database: string;
label: string;
description?: string;
}
export interface FunctionRegisterParams {
catalog: string;
database: string;
label: string;
description?: string;
}
export interface CommandRegisterParams {
catalogs?: CatalogRegisterParams[];
databases?: DatabaseRegisterParams[];
tables?: TableRegisterParams[];
columns?: ColumnRegisterParams[];
views?: ViewRegisterParams[];
functions?: FunctionRegisterParams[];
}
export declare class SchemaRegistry {
private _schemaNodes;
private defaultCatalog?;
private defaultDatabases;
constructor();
getSchemas(kind?: SchemaNodeKind): SchemaNode[];
getSchemaCatalogs(): SchemaCatalog[];
getSchemaDatabases(schema?: {
catalog?: string;
}): SchemaDatabase[];
getSchemaTables(schema?: {
catalog?: string;
database?: string;
}): SchemaTable[];
getSchemaColumns(schema?: {
catalog?: string;
database?: string;
table?: string;
}): SchemaTableColumn[];
getSchemaViews(schema?: {
catalog?: string;
database?: string;
}): SchemaView[];
getSchemaFunctions(schema?: {
catalog?: string;
database?: string;
}): SchemaFunction[];
register(registerMode: RegisterSchemaMode, schemas: CommandRegisterParams): void;
private registerCatalogs;
private registerDatabases;
private registerTables;
private registerColumns;
private registerViews;
private registerFunctions;
}
export {};