This repository has been archived by the owner on Dec 9, 2022. It is now read-only.
forked from sdnetwork/node-firebird
-
Notifications
You must be signed in to change notification settings - Fork 0
/
index.d.ts
60 lines (50 loc) · 2.47 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
// 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;
attachEvent(callback: (err: any, evtMgr: any) => void): 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;
}