Clientlinker-flow-mysql
Install
Install clientlinker
pkg
npm i clientlinker --save
Install flow pkg
npm i clientlinker-flow-mysql --save
Usage
var clientlinker = require('clientlinker');
var linker = clientlinker({
flows: ['mysql'],
clients: {
mysqlCustomClient: {
mysqlConfigFile: '/etc/dbconfig.conf',
mysqlConfigKey: 'DBItemName',
mysqlhandler: {
clientHanlder: {
sql: 'SELECT `name` FROM `db_example` WHERE `id`= ?',
keys: ['id'],
},
subKeys: {
sql: 'INSERT INTO `db_example` (`name`, `value`) VALUES ?',
keys: ['info'],
subKeys: {info: ['name', 'value']}
}
}
}
}
});
linker.loadFlow('mysql', 'clientlinker-flow-mysql', module);
// use
linker.run('mysqlCustomClient.clientHanlder', null, {id: 13})
.then(function(){});
linker.run('mysqlCustomClient.subKeys', null, {info: {name: 1, value: 2}});
linker.run('mysqlCustomClient.subKeys', null, {
info: [
{name: 1, value: 2},
{name: 2, value: 2}
]});