-
-
Notifications
You must be signed in to change notification settings - Fork 627
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
refactor: split common.js into lib modules
The proposal to put common.js into lib was good, but it felt weird to arbitrarily stuff just some exported functions in lib/common.js. This made sense when common.js was meant to provide commons for index.js and promise.js. But in the lib, this felt like a weird scope. I therefore split common.js into - lib/create_connection.js - lib/create_pool.js - lib/create_pool_cluster.js Also made `require` more consistent in all affected files: all `require` files now have a js suffix when they refer to a single local file.
- Loading branch information
Showing
7 changed files
with
54 additions
and
40 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
'use strict'; | ||
|
||
const Connection = require('./connection.js'); | ||
const ConnectionConfig = require('./connection_config.js'); | ||
|
||
function createConnection(opts) { | ||
return new Connection({ config: new ConnectionConfig(opts) }); | ||
} | ||
|
||
module.exports = createConnection; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
'use strict'; | ||
|
||
const Pool = require('./pool.js'); | ||
const PoolConfig = require('./pool_config.js'); | ||
|
||
function createPool(config) { | ||
return new Pool({ config: new PoolConfig(config) }); | ||
} | ||
|
||
module.exports = createPool |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
'use strict'; | ||
|
||
const PoolCluster = require('./pool_cluster.js'); | ||
|
||
function createPoolCluster(config) { | ||
return new PoolCluster(config); | ||
} | ||
|
||
module.exports = createPoolCluster; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -43,7 +43,6 @@ | |
"typings/mysql", | ||
"index.js", | ||
"index.d.ts", | ||
"common.js", | ||
"promise.js", | ||
"promise.d.ts" | ||
], | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters