Initial commit
This commit is contained in:
commit
c53c7085bc
60 changed files with 23885 additions and 0 deletions
29
flow/helper/db_helper.js
Normal file
29
flow/helper/db_helper.js
Normal file
|
|
@ -0,0 +1,29 @@
|
|||
|
||||
function promisifyBuilder(builder)
|
||||
{
|
||||
return new Promise((resolve, reject) => {
|
||||
|
||||
builder.callback(function(err, response) {
|
||||
|
||||
if(err != null) reject(err);
|
||||
resolve(response);
|
||||
});
|
||||
})
|
||||
}
|
||||
|
||||
function makeMapFromDbResult(response, key)
|
||||
{
|
||||
let data = {};
|
||||
for(let i = 0; i < response.length; i++)
|
||||
{
|
||||
let record = response[i];
|
||||
data[ record[key] ] = record;
|
||||
}
|
||||
|
||||
return data;
|
||||
}
|
||||
|
||||
module.exports = {
|
||||
promisifyBuilder,
|
||||
makeMapFromDbResult
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue