@@ -29,6 +29,8 @@ class DbHelper extends Helper {
2929 * @param {string|number } key Identification for using in other commands.
3030 * @param {string|object } conn JDBC-like connection string or a connection object accepted by `database-js`.
3131 * @param {object|undefined } driver [OPTIONAL] Driver object, used by `database-js`.
32+ *
33+ * @returns {Connection } DatabaseJS' connection
3234 */
3335 connect ( key , conn , driver ) {
3436 return this . connectionMap [ key ] = this . createConnection ( conn , driver ) ;
@@ -37,20 +39,24 @@ class DbHelper extends Helper {
3739 /**
3840 * Disconnects from the database identified by the given key.
3941 *
40- * @param {string|number } key Database identification key set in connect()
42+ * @param {string|number } key Database identification key set in connect().
43+ *
44+ * @returns {Promise<boolean> } If it was successful.
4145 */
4246 async disconnect ( key ) {
4347 let conn = this . connectionMap [ key ] ;
4448 if ( ! conn ) {
4549 throw this . _keyNotFoundError ( key ) ;
4650 }
47- return await conn . close ( ) ;
51+ return conn . close ( ) ;
4852 }
4953
5054 /**
5155 * Disconnects and removes the database connection identified by the given key.
5256 *
53- * @param {string|number } key Database identification key set in connect()
57+ * @param {string|number } key Database identification key set in connect().
58+ *
59+ * @returns {boolean } If it was successful.
5460 */
5561 async removeConnection ( key ) {
5662 if ( ! this . connectionMap [ key ] ) {
@@ -69,11 +75,11 @@ class DbHelper extends Helper {
6975 /**
7076 * Performs a query.
7177 *
72- * @param {string|number } key Database identification key set in connect()
78+ * @param {string|number } key Database identification key set in connect().
7379 * @param {string } command Query to run.
74- * @param {any[] } params [OPTIONAL] Query parameters
80+ * @param {any[] } params [OPTIONAL] Query parameters.
7581 *
76- * @returns {Promise<any[]> } Query results.
82+ * @returns {Promise<any[]> } Query results.
7783 */
7884 async query ( key , command , ... params ) {
7985 let conn = this . connectionMap [ key ] ;
@@ -82,19 +88,19 @@ class DbHelper extends Helper {
8288 }
8389 let stmt = conn . prepareStatement ( command ) ;
8490 if ( ! params ) {
85- return await stmt . query ( ) ;
91+ return stmt . query ( ) ;
8692 }
87- return await stmt . query ( ... params ) ;
93+ return stmt . query ( ... params ) ;
8894 }
8995
9096 /**
9197 * Executes a command.
9298 *
93- * @param {string|number } key Database identification key set in connect()
99+ * @param {string|number } key Database identification key set in connect().
94100 * @param {string } command Command to run.
95- * @param {any[] } params [OPTIONAL] Command parameters
101+ * @param {any[] } params [OPTIONAL] Command parameters.
96102 *
97- * @returns {Promise<any[]> } Command results.
103+ * @returns {Promise<any[]> } Command results.
98104 */
99105 async run ( key , command , ... params ) {
100106 let conn = this . connectionMap [ key ] ;
@@ -103,16 +109,18 @@ class DbHelper extends Helper {
103109 }
104110 let stmt = conn . prepareStatement ( command ) ;
105111 if ( ! params ) {
106- return await stmt . execute ( ) ;
112+ return stmt . execute ( ) ;
107113 }
108- return await stmt . execute ( ... params ) ;
114+ return stmt . execute ( ... params ) ;
109115 }
110116
111117 /**
112118 * Creates a database connection.
113119 *
114120 * @param {string|object } conn JDBC-like connection string or a connection object accepted by `database-js`.
115121 * @param {object|undefined } driver [OPTIONAL] Driver object, used by `database-js`.
122+ *
123+ * @returns {Connection } DatabaseJS' connection.
116124 */
117125 createConnection ( conn , driver ) {
118126 return new dbjs . Connection ( conn , driver ) ;
@@ -121,7 +129,9 @@ class DbHelper extends Helper {
121129 /**
122130 * Checks if there is a database connection with the given key.
123131 *
124- * @param {string|number } key Database identification key set in connect()
132+ * @param {string|number } key Database identification key set in connect().
133+ *
134+ * @returns {boolean }
125135 */
126136 hasConnection ( key ) {
127137 return ! ! this . connectionMap [ key ] ;
@@ -130,7 +140,9 @@ class DbHelper extends Helper {
130140 /**
131141 * Gets the database connection with the given key.
132142 *
133- * @param {string|number } key Database identification key set in connect()
143+ * @param {string|number } key Database identification key set in connect().
144+ *
145+ * @returns {Connection } DatabaseJS' connection.
134146 */
135147 getConnection ( key ) {
136148 return this . connectionMap [ key ] ;
@@ -139,7 +151,7 @@ class DbHelper extends Helper {
139151 /**
140152 * Creates an error that represents a database not found.
141153 *
142- * @param {string|number } key Database identification key
154+ * @param {string|number } key Database identification key.
143155 */
144156 _keyNotFoundError ( key ) {
145157 return new Error ( 'Database not found with the key ' + key ) ;
0 commit comments