-
Notifications
You must be signed in to change notification settings - Fork 1
/
index.d.ts
93 lines (93 loc) · 3.35 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
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
export = DbHelper;
/**
* Database helper for CodeceptJS
*
* @author Thiago Delgado Pinto
*/
declare class DbHelper {
/**
* Constructor
*
* @param {object} config CodeceptJS configuration.
*/
constructor(config: object);
options: any;
connectionMap: {};
/**
* Connects to the database described by the given connection string.
*
* @param {string|number} key Identification for using in other commands.
* @param {string|object} conn JDBC-like connection string or a connection object accepted by `database-js`.
* @param {object|undefined} [driver] [OPTIONAL] Driver object, used by `database-js`.
*
* @returns {Connection} DatabaseJS' connection
*/
connect(key: string | number, conn: string | object, driver?: object | undefined): any;
/**
* Disconnects and removes the database connection identified by the given key.
*
* @param {string|number} key Database identification key set in connect().
*
* @returns {Promise<boolean>} If it was successful.
*/
disconnect(key: string | number): Promise<boolean>;
/**
* Disconnects and removes the database connection identified by the given key.
*
* @param {string|number} key Database identification key set in connect().
*
* @returns {Promise<boolean>} If it was successful.
*/
removeConnection(key: string | number): Promise<boolean>;
/**
* Performs a query.
*
* @param {string|number} key Database identification key set in connect().
* @param {string} command Query to run.
* @param {...any[]|undefined} [params] [OPTIONAL] Query parameters.
*
* @returns {Promise<any[]>} Query results.
*/
query(key: string | number, command: string, ...params?: (any[] | undefined)[]): Promise<any[]>;
/**
* Executes a command.
*
* @param {string|number} key Database identification key set in connect().
* @param {string} command Command to run.
* @param {any[]} [params] [OPTIONAL] Command parameters.
*
* @returns {Promise<any[]>} Command results.
*/
run(key: string | number, command: string, ...params?: any[]): Promise<any[]>;
/**
* Creates a database connection.
*
* @param {string|object} conn JDBC-like connection string or a connection object accepted by `database-js`.
* @param {object|undefined} [driver] [OPTIONAL] Driver object, used by `database-js`.
*
* @returns {Connection} DatabaseJS' connection
*/
createConnection(conn: string | object, driver?: object | undefined): any;
/**
* Checks if there is a database connection with the given key.
*
* @param {string|number} key Database identification key set in connect().
*
* @returns {boolean}
*/
hasConnection(key: string | number): boolean;
/**
* Gets the database connection with the given key.
*
* @param {string|number} key Database identification key set in connect().
*
* @returns {Connection} DatabaseJS' connection.
*/
getConnection(key: string | number): any;
/**
* Creates an error that represents a database not found.
*
* @param {string|number} key Database identification key.
*/
_keyNotFoundError(key: string | number): Error;
}