Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/cjus/neo4j-redis
Neo4j adapter with Redis caching
https://github.com/cjus/neo4j-redis
Last synced: 3 months ago
JSON representation
Neo4j adapter with Redis caching
- Host: GitHub
- URL: https://github.com/cjus/neo4j-redis
- Owner: cjus
- License: mit
- Created: 2016-12-08T23:58:19.000Z (about 8 years ago)
- Default Branch: master
- Last Pushed: 2017-08-09T04:30:12.000Z (over 7 years ago)
- Last Synced: 2024-09-30T07:20:59.038Z (3 months ago)
- Language: JavaScript
- Homepage:
- Size: 16.6 KB
- Stars: 7
- Watchers: 3
- Forks: 1
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# Neo4j-redis
[![npm version](https://badge.fury.io/js/neo4j-redis.svg)](https://badge.fury.io/js/neo4j-redis) [![npm](https://img.shields.io/npm/l/neo4j-redis.svg)]()
Neo4j-redis, a promised-based Neo4j transactions adapter which optionally supports caching using Redis.
## Usage
```javascript
const Neo4j = require('neo4j-redis');
let neo4j = new Neo4j();
neo4j.initGraphDB('http://127.0.0.1:7474', 'neo4j', 'password');
```## APIs
This module contains a core exported class Neo4j. In turn it also creates `Transaction` and `QueryBuilder` objects.#### Core API
| Method | Description | Notes |
| --- | --- | --- |
| initGraphDB | Initialize Neo4j Graph Database | Required |
| initCacheDB | Initialize Redis Database for caching | Only used if caching is desired |
| createTransaction | Creates a transaction object | See Transaction API section |
| createQueryBuilder | Creates a new query builder object | See Query Build API section |
| getSimpleData | Helper to extra simple data responses | Simple data is defined as a single return value. A single object qualifies |
| toProps | Convert an object of properties to a property query string | |
| toNamedProps | Converts a named object to a cypher compatible key / value pair | |
| toSets | Converts an object to a cypher compatible list of set statements | |#### Transaction API
| Method | Description | Notes |
| --- | --- | --- |
| addQuery | Appends a query to the transaction's list of query statements | Requires a Query Builder object and params |
| cacheable | Marks a transaction as cacheable ||
| execute | Executes a transaction ||#### Query Builder API
| Method | Description | Notes |
| --- | --- | --- |
| add | Adds a partial query statement | |
| toString | Returns the full query as a string ||## Tests
The `specs` folder contains tests.
To run the tests you first need to install mocha:
```shell
$ npm install mocha -g
```Then run:
```shell
$ npm run test
```