mirror of
https://github.com/lifegpc/eh-downloader.git
synced 2026-07-08 01:31:00 +08:00
Add support for both wasm/ffi version of sqlite3
This commit is contained in:
28
utils/db_interface.ts
Normal file
28
utils/db_interface.ts
Normal file
@@ -0,0 +1,28 @@
|
||||
export type Row = Array<unknown>;
|
||||
export type RowObject = Record<string, unknown>;
|
||||
export type QueryParameter =
|
||||
| boolean
|
||||
| number
|
||||
| bigint
|
||||
| string
|
||||
| null
|
||||
| undefined
|
||||
| Date
|
||||
| Uint8Array;
|
||||
export type QueryParameterSet =
|
||||
| Record<string, QueryParameter>
|
||||
| Array<QueryParameter>;
|
||||
|
||||
export interface Db {
|
||||
close(force?: boolean): void;
|
||||
execute(sql: string): void;
|
||||
query<R extends Row = Row>(
|
||||
sql: string,
|
||||
params?: QueryParameterSet,
|
||||
): Array<R>;
|
||||
queryEntries<O extends RowObject = RowObject>(
|
||||
sql: string,
|
||||
params?: QueryParameterSet,
|
||||
): Array<O>;
|
||||
transaction<V>(fn: () => V): V;
|
||||
}
|
||||
Reference in New Issue
Block a user