-
Notifications
You must be signed in to change notification settings - Fork 2
/
index.d.ts
60 lines (51 loc) · 1.07 KB
/
index.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
/**
* Creates an sql handler
*/
export function connect(params: SqlConnectParams): SqlHandler;
/**
* Disposes of all handlers
*/
export function dispose(): void;
interface SqlConnectParams {
url: string;
driver: string;
maxPoolSize?: number;
minPoolSize?: number;
poolName?: string;
user?: string;
password?: string;
}
interface SqlHandler {
/**
* Returns an array of results based on a query
*/
query<A>(sql: string, limit?: number): SQLQueryResult<A>;
/**
* Returns the first result from a query
*/
queryFirst<A>(sql: string): A;
/**
* Execute a simple insert statement
* @return {number} the number of rows inserted
*/
insert(sql: string): number;
/**
* Execute a simple update statement
* @return {number} the number of updated inserted
*/
update(sql: string): number;
/**
* Execute some SQL with no return value
*/
execute(sql: string): void;
}
interface SQLQueryResult<A> {
/**
* The number of results
*/
readonly count: number;
/**
* An array of results
*/
readonly result: Array<A>;
}