You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
27 lines
732 B
27 lines
732 B
export type SqlValue = string | number | null | Uint8Array;
|
|
|
|
export interface QueryExecResult {
|
|
columns: Array<string>;
|
|
values: Array<Array<SqlValue>>;
|
|
}
|
|
|
|
export interface DatabaseExecResult {
|
|
changes: number;
|
|
lastId?: number;
|
|
}
|
|
|
|
export interface DatabaseService {
|
|
initialize(): Promise<void>;
|
|
query(sql: string, params?: unknown[]): Promise<QueryExecResult[]>;
|
|
run(sql: string, params?: unknown[]): Promise<DatabaseExecResult>;
|
|
}
|
|
|
|
/**
|
|
* Generic database result type for mapped query results
|
|
*/
|
|
export type DatabaseResult<T = Record<string, unknown>> = T;
|
|
|
|
/**
|
|
* Database query result that can be either a single result or an array
|
|
*/
|
|
export type DatabaseQueryResult<T = Record<string, unknown>> = T | T[] | null;
|
|
|