@servitech/neo4j-helpers

0.2.6 • Public • Published

Neo4j Helpers

This package provides helper functions when using a neo4j database to save time and to prevent repeating a bunch of code. It is especially useful if you have data in JSON format.

Install

# with npm 
npm install @servitech/neo4j-helpers --save

Usage

Require the package, then configure with configureDb() using your database details. (see configureDb() function below for more information)

const neocon = require('@servitech/neo4j-helpers');
neocon.configureDb(process.env.NEO4J_HOST, process.env.NEO4J_USER, process.env.NEO4J_PASSWORD, {disableLosslessIntegers: true});

Functions

  • configureDb() - configureDb(host, username, password, options) - Configure your neo4j driver by passing the host server string (bolt://myNeo4j:7687), username, password, and optionally pass an object with neo4j.driver config options, for example: {disableLosslessIntegers: true}. This function instantiates the neo4j driver with these details.

  • executeCypher() - executeCypher(query, param) - Returns Promise. This function instantiates the neo4j connection and accepts a query to run. Resolves with result, or rejects with an error. Optionally set params for your custom cypher query in object format. (params replaces need for jsonToCypherForAddOrUpdate method).

  • jsonToCypherForAddOrUpdate() - DEPRECATED.

  • saveNode() - saveNode(nodeName, jsonIn) - Saves stringified json objects to database. Replaces jsonToCypherForAddOrUpdate().

  • parseObject() - parseObject(jsonIn) - Loops through the top level of a JSON object and parses any string that starts with [ or { into an object.

Versions

Current Tags

  • Version
    Downloads (Last 7 Days)
    • Tag
  • 0.2.6
    6
    • latest

Version History

Package Sidebar

Install

npm i @servitech/neo4j-helpers

Weekly Downloads

6

Version

0.2.6

License

UNLICENSED

Unpacked Size

8.95 kB

Total Files

5

Last publish

Collaborators

  • corey-lapka
  • kalen.shuck