forked from jsnbuchanan/crowd-funder-for-time-pwa
- Replace any[] with SqlValue[] type for SQL parameters in runMigrations - Update import to use QueryExecResult from interfaces/database - Add proper typing for SQL parameter values (string | number | null | Uint8Array) This change improves type safety and helps catch potential SQL parameter type mismatches at compile time, reducing the risk of runtime errors or data corruption.
18 lines
540 B
TypeScript
18 lines
540 B
TypeScript
export type SqlValue = string | number | null | Uint8Array;
|
|
|
|
export interface QueryExecResult {
|
|
columns: Array<string>;
|
|
values: Array<Array<SqlValue>>;
|
|
}
|
|
|
|
export interface DatabaseService {
|
|
initialize(): Promise<void>;
|
|
query(sql: string, params?: unknown[]): Promise<QueryExecResult[]>;
|
|
run(
|
|
sql: string,
|
|
params?: unknown[],
|
|
): Promise<{ changes: number; lastId?: number }>;
|
|
getOneRow(sql: string, params?: unknown[]): Promise<unknown[] | undefined>;
|
|
getAll(sql: string, params?: unknown[]): Promise<unknown[][]>;
|
|
}
|