refactor(desktop): organize lib modules by domain
This commit is contained in:
1 parent
90f0594e93
commit
7e7c4944e9
700 files changed
+1292
-1264
No files matched your search
@@ -0,0 +1,46 @@
|
||||
import type { DatabaseType, ObjectSourceKind } from "@/types/database";
|
||||
import * as api from "@/lib/backend/api";
|
||||
|
||||
export type BuildEditableObjectSourceSqlInput = {
|
||||
databaseType: DatabaseType;
|
||||
objectType: ObjectSourceKind;
|
||||
schema?: string | null;
|
||||
name: string;
|
||||
source: string;
|
||||
};
|
||||
|
||||
export type BuildRoutineRenameObjectSourceInput = BuildEditableObjectSourceSqlInput & {
|
||||
newName: string;
|
||||
};
|
||||
|
||||
export type ObjectSourceSaveExecutionMode = "single" | "script";
|
||||
|
||||
const postgresLikeRoutineRenameTypes = new Set<DatabaseType>(["postgres", "redshift", "gaussdb", "kwdb", "kingbase", "highgo", "vastbase"]);
|
||||
const mysqlLikeRoutineRenameTypes = new Set<DatabaseType>(["mysql", "goldendb"]);
|
||||
const oracleLikeRoutineRenameTypes = new Set<DatabaseType>(["oracle", "dameng"]);
|
||||
|
||||
export function supportsSourceBackedRoutineRename(databaseType: DatabaseType | undefined, objectType: ObjectSourceKind): boolean {
|
||||
if (objectType !== "FUNCTION" && objectType !== "PROCEDURE") return false;
|
||||
if (!databaseType || databaseType === "sqlserver") return false;
|
||||
return mysqlLikeRoutineRenameTypes.has(databaseType) || postgresLikeRoutineRenameTypes.has(databaseType) || oracleLikeRoutineRenameTypes.has(databaseType);
|
||||
}
|
||||
|
||||
export function buildRoutineRenameObjectSourceStatements(input: BuildRoutineRenameObjectSourceInput): Promise<string[]> {
|
||||
return api.buildRoutineRenameObjectSourceStatements(input);
|
||||
}
|
||||
|
||||
export function buildExecutableObjectSourceStatements(input: BuildEditableObjectSourceSqlInput): Promise<string[]> {
|
||||
return api.buildExecutableObjectSourceStatements(input);
|
||||
}
|
||||
|
||||
export async function buildExecutableObjectSourceSql(input: BuildEditableObjectSourceSqlInput): Promise<string> {
|
||||
return api.buildExecutableObjectSourceSql(input);
|
||||
}
|
||||
|
||||
export function buildEditableObjectSource(input: BuildEditableObjectSourceSqlInput): Promise<string> {
|
||||
return api.buildEditableObjectSource(input);
|
||||
}
|
||||
|
||||
export function objectSourceSaveExecutionMode(_databaseType: DatabaseType): ObjectSourceSaveExecutionMode {
|
||||
return "single";
|
||||
}
|
||||
Reference in new issue
Block a user