Skip to content

Commit

Permalink
Implemented OrientDBClient#listDatabases
Browse files Browse the repository at this point in the history
  • Loading branch information
wolf4ood committed Jun 28, 2018
1 parent 18a03f6 commit ca9fb56
Show file tree
Hide file tree
Showing 3 changed files with 446 additions and 312 deletions.
23 changes: 23 additions & 0 deletions lib/client/client.js
Expand Up @@ -229,6 +229,29 @@ class OrientDBClient extends EventEmitter {
});
}

/**
* List all the databases on the server.
* @param {Object} options Options object
* @param {String} options.username Server user
* @param {String} options.password Server password
* @returns {Promise<Array>}
*/
listDatabases(options) {
return this._runAsAdmin(options, ctx => {
return ctx.conn
.send(
"db-list",
Object.assign({}, options, {
sessionId: ctx.sessionId,
token: ctx.token
})
)
.then(response => {
return response.databases;
});
});
}

_runAsAdmin(options, work) {
return new Promise((resolve, reject) => {
let ctx = { options: options };
Expand Down

0 comments on commit ca9fb56

Please sign in to comment.