@acastellon/neo4j
Advanced tools
Comparing version 1.0.3 to 1.0.4
@@ -51,2 +51,5 @@ "use strict"; | ||
const neo4jIntsToStrings = (json) => { | ||
if (json == null) return ''; | ||
const pluckAndModify = (isMatch, transformValue) => | ||
@@ -59,3 +62,3 @@ Object.entries(json) | ||
pluckAndModify(([, value]) => typeof value === 'object', neo4jIntsToStrings), | ||
pluckAndModify(([, value]) => neo4j.isInt(value), value => value.toString()), | ||
pluckAndModify(([, value]) => neo4j.isInt(value), value => value.toString()) | ||
); | ||
@@ -78,6 +81,6 @@ }; | ||
/** | ||
* Executing ans returning an un-mutable results. | ||
* Executing and returning an un-mutable results. | ||
* @param cypher - String with the cypher sentence to be executed | ||
* @param parameters - JSON object with the parameters to be used in substitution with the Cypher Sentence | ||
* @param options - optinal JSON object that contains 'conn' the driver connection, 'session' driver session, 'close' if both need to be closed at the end of the execution | ||
* @param options - optional JSON object that contains 'conn' the driver connection, 'session' driver session, 'close' if both need to be closed at the end of the execution | ||
* @return an object or List of Objects of the fields | ||
@@ -84,0 +87,0 @@ */ |
{ | ||
"name": "@acastellon/neo4j", | ||
"version": "1.0.3", | ||
"version": "1.0.4", | ||
"description": "Neo4j persistence interface", | ||
@@ -5,0 +5,0 @@ "main": "neo4j.js", |
# neo4j | ||
module Neo4j for nodejs | ||
A Simplified interface to Neo4j database using the official neo4j-driver library | ||
#### configuration | ||
saved for example as 'config.neo4j.js' | ||
module.exports = { | ||
NEO4J_URL: 'bolt://127.0.0.1:11002' | ||
,NEO4J_USER: 'neo4j' | ||
,NEO4J_PASSWORD: 'neo4j2019' | ||
// ,NEO4J_DATABASE: '<database_name>' // available in the future in v4.0 | ||
,TRACES : true | ||
} | ||
#### usage: | ||
const config = require('./config.neo4j.js'); | ||
const db = require('@acastellon/neo4j')(config); | ||
#### methods | ||
##### Executing and returning an un-mutable results. | ||
execute(cypher, parameters [, options]) | ||
* @param cypher - String with the cypher sentence to be executed | ||
* @param parameters - JSON object with the parameters to be used in substitution with the Cypher Sentence | ||
* @param options - optional JSON object that contains the connection and the session (generated automatically if it's null) | ||
* @return an object or List of Objects of the fields | ||
##### Execute the sentence and returns a Promise | ||
executeAsPromise(cypher, parameters [, options]) | ||
* @param cypher - String with the cypher sentence to be executed | ||
* @param parameters - JSON object with the parameters to be used in substitution with the Cypher Sentence | ||
* @param options - optional JSON object that contains the connection and the session (generated automatically if it's null) | ||
##### Execute and return an Stream object for the results. Used for long results. | ||
executeAsStream(cypher, parameters [, options]) | ||
* @param cypher - String with the cypher sentence to be executed | ||
* @param parameters - JSON object with the parameters to be used in substitution with the Cypher Sentence | ||
* @param options - optional JSON object that contains the connection and the session (generated automatically if it's null) | ||
* @returns {Stream.Readable} | ||
##### Execute Cypher sentences as a BATCH | ||
executeBatch(queries [,options]); | ||
* @param queries - a List of objects with pair keys { cypher : '', parameters: '' } to be executed | ||
* @param options - optional JSON object that contains the connection and the session (generated automatically if it's null) | ||
* @returns {boolean} if the batch was executed successfully |
15173
269
58