forked from hgourvest/node-firebird
-
Notifications
You must be signed in to change notification settings - Fork 18
/
index.d.ts
59 lines (49 loc) · 2.43 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
// Type definitions for node-firebird 0.8.3
// Project: node-firebird
// Definitions by: Marco Warm <https://github.com/MarcusCalidus>
declare module 'node-firebird' {
type DatabaseCallback = (err: any, db: Database) => void;
type TransactionCallback = (err: Options, transaction: Transaction) => void;
type QueryCallback = (err: any, result: any[]) => void;
type SimpleCallback = (err: any) => void;
type SequentialCallback = (row: any, index: number, next: any) => void;
export const ISOLATION_READ_UNCOMMITTED: number[];
export const ISOLATION_READ_COMMITED: number[];
export const ISOLATION_REPEATABLE_READ: number[];
export const ISOLATION_SERIALIZABLE: number[];
export const ISOLATION_READ_COMMITED_READ_ONLY: number[];
export type Isolation = number[];
export interface Database {
detach(callback?: SimpleCallback): void;
transaction(isolation: Isolation, callback: TransactionCallback): void;
query(query: string, params: any[], callback: QueryCallback): void;
execute(query: string, params: any[], callback: QueryCallback): void;
sequentially(query: string, params: any[], rowCallback: SequentialCallback, callback: SimpleCallback, asArray?: boolean): void;
}
export interface Transaction {
query(query: string, params: any[], callback: QueryCallback): void;
execute(query: string, params: any[], callback: QueryCallback): void;
commit(callback?: SimpleCallback): void;
rollback(callback?: SimpleCallback): void;
sequentially(query: string, params: any[], rowCallback: SequentialCallback, callback: SimpleCallback, asArray?: boolean): void;
}
export interface Options {
host?: string;
port?: number;
database?: string;
user?: string;
password?: string;
lowercase_keys?: boolean;
role?: string;
pageSize?: number;
}
export interface ConnectionPool {
get(callback: DatabaseCallback): void;
destroy(): void;
}
export function attach(options: Options, callback: DatabaseCallback): void;
export function escape(value: string): string;
export function create(options: Options, callback: DatabaseCallback): void;
export function attachOrCreate(options: Options, callback: DatabaseCallback): void;
export function pool(max: number,options: Options, callback: DatabaseCallback): ConnectionPool;
}