First version without typescript errors

This commit is contained in:
2026-06-21 07:05:49 +01:00
parent 9c8f6e20aa
commit eb86e1803d
16 changed files with 362 additions and 223 deletions
+2 -15
View File
@@ -5,9 +5,6 @@ import grabDBConnection from "./grab-db-connection";
type Param = {
query: string;
values?: string[] | object;
noErrorLogs?: boolean;
database?: string;
tableSchema?: BUN_MARIADB_TableSchemaType;
config?: ConnectionConfig;
};
@@ -17,18 +14,12 @@ type Param = {
*/
export default async function dbHandler<
T extends { [k: string]: any } = { [k: string]: any },
>({
query,
values,
noErrorLogs,
database,
config,
}: Param): Promise<DBResponseObject> {
>({ query, values, config }: Param): Promise<DBResponseObject> {
let CONNECTION: Connection | undefined;
let results: T | null = null;
try {
CONNECTION = await grabDBConnection({ database, config });
CONNECTION = await grabDBConnection({ config });
if (query && values) {
const queryResults = await CONNECTION.query(query, values);
@@ -46,10 +37,6 @@ export default async function dbHandler<
throw new Error("Authentication Failed!");
}
if (!noErrorLogs) {
console.log(error);
}
results = null;
} finally {
await CONNECTION?.end();