wise-paas-datahub-dbmanager
v2.2.26
Published
wise-paas-datahub-dbmanager is a utility of WISE-PaaS/DataHub for database management.
Downloads
11
Readme
wise-paas-datahub-dbmanager
wise-paas-datahub-dbmanager is a utility of WISE-PaaS/DataHub for database management.
Installation
npm install wise-paas-datahub-dbmanager
Initial
const DBManager = require('wise-paas-datahub-dbmanager');
let conf = {
hostname: '127.0.0.1',
port: 5432,
username: 'admin',
password: '1234',
database: 'postgres'
};
DBManager.init(conf);
API
DBManager
init(postgresConf)
conn()
get sequelizeNodeDao
DeviceDao
TagDao
UserDao
nodeDao
getNodeList
getNode(nodeId)
insertNode(nodeObj, transaction)
updateNode(nodeObj, nodeId, transaction)
deleteNode(nodeId, transaction)
deviceDao
getDevice(nodeId, deviceId)
getDeviceListByNodeId(nodeId)
insertDevice(deviceObj, transaction)
updateDevice(deviceObj, nodeId, deviceId, transaction)
deleteDevice(nodeId, deviceId, transaction)
deleteDeviceListByNodeId(nodeId, transaction)
tagDao
getTag(nodeId, deviceId, tagName)
getTagListByNodeId(nodeId)
getTagListBydeviceId(nodeId, deviceId)
getAnalogTag(nodeId, deviceId, tagName)
getDiscreteTag(nodeId, deviceId, tagName)
getTextTag(nodeId, deviceId, tagName)
getAlarmAnalogTag(nodeId, deviceId, tagName)
getAlarmDiscreteTag(nodeId, deviceId, tagName)
getWholeTagListByNodeId(nodeId)
getWholeTagListByDeviceId(nodeId, deviceId)
insertTag(tagObj, transaction)
insertAnalogTag(tagObj, transaction)
insertDiscreteTag(tagObj, transaction)
insertTextTag(tagObj, transaction)
insertAlarmAnalogTag(tagObj, transaction)
insertAlarmDiscreteTag(tagObj, transaction)
updateTag(tagObj, nodeId, deviceId, tagName, transaction)
updateAnalogTag(tagObj, nodeId, deviceId, tagName, transaction)
updateDiscreteTag(tagObj, nodeId, deviceId, tagName, transaction)
updateTextTag(tagObj, nodeId, deviceId, tagName, transaction)
updateAlarmAnalogTag(tagObj, nodeId, deviceId, tagName, transaction)
updateAlarmDiscreteTag(tagObj, nodeId, deviceId, tagName, transaction)
deleteTagListByNodeId(nodeId, transaction)
deleteTagListByDeviceId(nodeId, deviceId, transaction)
deleteTag(nodeId, deviceId, tagName, transaction)
deleteAlarmTag(nodeId, deviceId, tagName, type, transaction)
userDao
getUserList()
getUserById(userId)
getUserByName(userName)
getUserScopeById(userId)
insertUser(userObj, trans)
insertUserScopeById(userId, scopeList, trans)
updateUserByName(userName, userObj, trans)
updateUserScopeByName(userName, scopeList, trans)
updateUserScopeById(userId, scopeList, trans)
deleteUserById(userId, trans)
deleteUserScope(userId, trans)
roleDao
insertRole(roleObj, trans)
insertRoleScope(roleId, scopeList, trans)
updateRole(roleId, roleObj, trans)
updateRoleScope(roleId, scopeList, trans)
deleteRole(roleId, trans)
deleteRoleScope(roleId, trans)
Example
get node list
const DBManager = require('wise-paas-datahub-dbmanager');
let conf = {
hostname: '127.0.0.1',
port: 5432,
username: 'admin',
password: '1234',
database: 'postgres'
};
DBManager.init(conf);
var nodeDao = DBManager.NodeDao;
nodeDao.getNodeList().then((result) => {
console.log(result);
}).catch((error) => {
console.error(error);
});