1.0.5 • Published 3 years ago
egg-neo4j-tool v1.0.5
egg-neo4j-tool
Neo4j for egg framework.
Install
$ npm i egg-neo4j-tool --save
Usage
// {app_root}/config/plugin.js
exports.neo4j = {
enable: true,
package: 'egg-neo4j-tool',
};
Configuration
// {app_root}/config/config.default.js
exports.neo4j = {
client: {
url: 'bolt://127.0.0.1',
username: 'neo4j',
password: 'neo4j',
},
};
see config/config.default.js for more detail.
Example
Assume that we have User
nodes in our database and we want to fetch all of them:
async function all() {
const session = this.ctx.app.neo4j.session();
try {
const result = await session.run('MATCH(user:User) RETURN user');
return result.records.map((item) => item.get('user').properties);
} finally {
session.close();
}
}
Questions & Suggestions
Please open an issue here.
PRs welcome!