dsql-admin/dsql-app/package-shared/utils/backend/global-db/LOCAL_DB_HANDLER.ts
Benjamin Toby 81cf010cb5 Updates
2025-01-14 16:27:08 +01:00

25 lines
584 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();
console.log("Querying ...");
try {
const results = await MASTER.query(...args);
return JSON.parse(JSON.stringify(results));
} catch (error: any) {
console.log("DB Error =>", error.message);
return {
success: false,
error: error.message,
};
} finally {
await MASTER?.end();
}
}