forked from lingdojo/kana-dojo
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathsql.js.d.ts
More file actions
51 lines (45 loc) · 1.28 KB
/
sql.js.d.ts
File metadata and controls
51 lines (45 loc) · 1.28 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
/**
* Type declarations for sql.js
*
* sql.js is a JavaScript SQL database library that uses Emscripten to compile
* SQLite to WebAssembly.
*/
declare module 'sql.js' {
export interface SqlJsStatic {
Database: typeof Database;
}
export interface Database {
run(sql: string, params?: unknown[]): Database;
exec(sql: string, params?: unknown[]): QueryExecResult[];
each(
sql: string,
params: unknown[],
callback: (row: unknown) => void,
done: () => void,
): Database;
prepare(sql: string): Statement;
export(): Uint8Array;
close(): void;
getRowsModified(): number;
create_function(name: string, func: (...args: unknown[]) => unknown): void;
}
export interface Statement {
bind(params?: unknown[]): boolean;
step(): boolean;
getColumnNames(): string[];
get(params?: unknown[]): unknown[];
getAsObject(params?: unknown[]): Record<string, unknown>;
run(params?: unknown[]): void;
reset(): void;
free(): boolean;
}
export interface QueryExecResult {
columns: string[];
values: unknown[][];
}
export interface SqlJsConfig {
locateFile?: (file: string) => string;
wasmBinary?: ArrayBuffer;
}
export default function initSqlJs(config?: SqlJsConfig): Promise<SqlJsStatic>;
}