forked from DefinitelyTyped/DefinitelyTyped
-
Notifications
You must be signed in to change notification settings - Fork 0
/
sql.js.d.ts
67 lines (47 loc) · 2.57 KB
/
sql.js.d.ts
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
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
// Type definitions for sql.js
// Project: https://github.com/kripken/sql.js
// Definitions by: George Wu <https://github.com/Hozuki/>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
/// <reference path="../node/node.d.ts" />
declare module "sql.js" {
class Database {
constructor(data: Buffer);
constructor(data: Uint8Array);
constructor(data: number[]);
run(sql: string): Database;
run(sql: string, params: { [key: string]: number | string | Uint8Array }): Database;
run(sql: string, params: (number | string | Uint8Array)[]): Database;
exec(sql: string): QueryResults[];
each(sql: string, callback: (obj: { [columnName: string]: number | string | Uint8Array }) => void, done: () => void): void;
each(sql: string, params: { [key: string]: number | string | Uint8Array }, callback: (obj: { [columnName: string]: number | string | Uint8Array }) => void, done: () => void): void;
each(sql: string, params: (number | string | Uint8Array)[], callback: (obj: { [columnName: string]: number | string | Uint8Array }) => void, done: () => void): void;
prepare(sql: string): Statement;
prepare(sql: string, params: { [key: string]: number | string | Uint8Array }): Statement;
prepare(sql: string, params: (number | string | Uint8Array)[]): Statement;
export(): Uint8Array;
close(): void;
}
class Statement {
bind(): boolean;
bind(values: { [key: string]: number | string | Uint8Array }): boolean;
bind(values: (number | string | Uint8Array)[]): boolean;
step(): boolean;
get(): (number | string | Uint8Array)[];
get(params: { [key: string]: number | string | Uint8Array }): (number | string | Uint8Array)[];
get(params: (number | string | Uint8Array)[]): (number | string | Uint8Array)[];
getColumnNames(): string[];
getAsObject(): { [columnName: string]: number | string | Uint8Array };
getAsObject(params: { [key: string]: number | string | Uint8Array }): { [columnName: string]: number | string | Uint8Array };
getAsObject(params: (number | string | Uint8Array)[]): { [columnName: string]: number | string | Uint8Array };
run(): void;
run(values: { [key: string]: number | string | Uint8Array }): void;
run(values: (number | string | Uint8Array)[]): void;
reset(): void;
freemem(): void;
free(): boolean;
}
interface QueryResults {
columns: string[];
values: (number | string | Uint8Array)[][];
}
}