@acastellon/neo4j 中文文档教程

发布于 5年前 浏览 20 项目主页 更新于 3年前

neo4j

使用官方 neo4j 驱动程序库的 Neo4j 数据库的简化接口

configuration

,例如保存为“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

neo4j

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
    我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
    原文