Grok 5 updates
This commit is contained in:
@@ -0,0 +1,48 @@
|
||||
import type { BunMariaDBConfig } from "../../types";
|
||||
import dbHandler from "../db-handler";
|
||||
|
||||
export default async function runSchemaQuery({
|
||||
query,
|
||||
values,
|
||||
config,
|
||||
}: {
|
||||
query: string;
|
||||
values?: any[];
|
||||
config?: BunMariaDBConfig;
|
||||
}): Promise<void> {
|
||||
const res = await dbHandler({
|
||||
query,
|
||||
values,
|
||||
config,
|
||||
});
|
||||
|
||||
if (!res.success) {
|
||||
throw new Error(
|
||||
`Database query failed: ${query} ... ERROR: ${res.error || res.msg}`,
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
export async function querySchemaRows<T extends Record<string, any>>({
|
||||
query,
|
||||
values,
|
||||
config,
|
||||
}: {
|
||||
query: string;
|
||||
values?: any[];
|
||||
config?: BunMariaDBConfig;
|
||||
}): Promise<T[]> {
|
||||
const res = await dbHandler<T>({
|
||||
query,
|
||||
values,
|
||||
config,
|
||||
});
|
||||
|
||||
if (!res.success) {
|
||||
throw new Error(
|
||||
`Database query failed: ${query} ... ERROR: ${res.error || res.msg}`,
|
||||
);
|
||||
}
|
||||
|
||||
return (res.payload || []) as T[];
|
||||
}
|
||||
Reference in New Issue
Block a user