datasquirel/package-shared/shell/utils/noDatabaseDbHandler.ts
2025-01-10 20:10:28 +01:00

43 lines
1003 B
TypeScript
Executable File

import dbHandler from "./dbHandler";
/**
* # Create database from Schema Function
*/
export default async function noDatabaseDbHandler(
queryString: string
): Promise<any> {
/**
* Declare variables
*
* @description Declare "results" variable
*/
let results;
/**
* Fetch from db
*
* @description Fetch data from db if no cache
*/
try {
/** ********************* Run Query */
results = await dbHandler({ query: queryString });
////////////////////////////////////////
////////////////////////////////////////
////////////////////////////////////////
} catch (error: any) {
console.log("ERROR in noDatabaseDbHandler =>", error.message);
}
/**
* Return results
*
* @description Return results add to cache if "req" param is passed
*/
if (results) {
return results;
} else {
return null;
}
}