dsql-admin/dsql-app/package-shared/utils/backend/global-db/LOCAL_DB_HANDLER.ts
Benjamin Toby b9f012cb9b Updates
2025-02-19 20:38:56 +01:00

23 lines
574 B
TypeScript

import grabDSQLConnection from "../../grab-dsql-connection";
/**
* # DSQL user read-only DB handler
*/
export default async function LOCAL_DB_HANDLER(...args: any[]) {
const MASTER = grabDSQLConnection();
try {
const results = await MASTER.query(...args);
return JSON.parse(JSON.stringify(results));
} catch (error: any) {
global.ERROR_CALLBACK?.(`LOCAL_DB_HANDLER Error`, error as Error);
return {
success: false,
error: error.message,
};
} finally {
await MASTER?.end();
}
}