Comparing version 0.1.2 to 0.2.0
{ | ||
"name": "decypher", | ||
"version": "0.1.2", | ||
"description": "Yesql-like cypher query loader for node.js", | ||
"main": "decypher.js", | ||
"version": "0.2.0", | ||
"description": "A handful of cypher utilities for Node.js", | ||
"main": "index.js", | ||
"scripts": { | ||
"test": "mocha -R spec ./test/unit.js" | ||
"test": "mocha -R spec ./test" | ||
}, | ||
@@ -15,3 +15,7 @@ "repository": { | ||
"cypher", | ||
"neo4j" | ||
"neo4j", | ||
"query builder", | ||
"query", | ||
"builder", | ||
"batch" | ||
], | ||
@@ -26,3 +30,7 @@ "author": "Yomguithereal", | ||
"mocha": "^2.1.0" | ||
}, | ||
"dependencies": { | ||
"lodash.assign": "^3.2.0", | ||
"lodash.isplainobject": "^3.2.0" | ||
} | ||
} |
@@ -5,6 +5,9 @@ [![Build Status](https://travis-ci.org/Yomguithereal/decypher.svg)](https://travis-ci.org/Yomguithereal/decypher) | ||
**decypher** is a node.js library aiming at loading [cypher](http://neo4j.com/developer/cypher-query-language/) queries from external files so you can use them later in your code. | ||
**decypher** is a node.js library packing a handful of utilities to deal with [cypher](http://neo4j.com/developer/cypher-query-language/) queries. | ||
The library's philosophy is quite similar to the Clojure [Yesql](https://github.com/krisajenkins/yesql)'s one. | ||
It includes the following: | ||
* A [Yesql](https://github.com/krisajenkins/yesql)-like [query loader](#query-loader). | ||
* A simple [query builder](#query-builder). | ||
## Installation | ||
@@ -24,3 +27,3 @@ | ||
## Usage | ||
## Query loader | ||
@@ -55,3 +58,3 @@ ### Query files | ||
To load you queries, just require **decypher** and use it to load your queries: | ||
Just require **decypher** and use it to load your queries: | ||
@@ -104,2 +107,41 @@ ```js | ||
## Query builder | ||
Note that this query builder is widely inspired by the [query-builder](https://github.com/shesek/cypher-query) package by [@shesek](https://github.com/shesek) but fixed and updated to support cypher's latest evolutions. | ||
```js | ||
var cypher = require('decypher').builder; | ||
// Creating a query | ||
var query = cypher() | ||
.match('MATCH (n:Node)') | ||
.where('n.title = {title}', {title: 'The best title'}) | ||
.return('n'); | ||
// Compiling to string | ||
query.compile(); | ||
// or | ||
query.toString(); | ||
// MATCH (n:Node) | ||
// WHERE n.title = {title} | ||
// RETURN n;' | ||
// Retrieving the query's parameters | ||
query.params(); | ||
>>> { | ||
title: 'The best title' | ||
} | ||
// Note that multi words statements like `ORDER BY` | ||
// have to be written in camel-case: | ||
query.orderBy('n.title'); | ||
// You can also set a bunch of params at once | ||
query.params({whatever: 'is needed'}); | ||
// Finally, you can add arbitrary parts to the query if required | ||
query.add('anything you want'); | ||
query.add('with {param}', {param: 'heart'}); | ||
``` | ||
## Contribution | ||
@@ -119,1 +161,10 @@ | ||
``` | ||
## Roadmap | ||
* Some helpers | ||
* A batch | ||
## License | ||
[MIT](LICENSE.txt) |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
Major refactor
Supply chain riskPackage has recently undergone a major refactor. It may be unstable or indicate significant internal changes. Use caution when updating to versions that include significant changes.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
10368
6
195
166
2
1
+ Addedlodash.assign@^3.2.0
+ Addedlodash.isplainobject@^3.2.0
+ Addedlodash._baseassign@3.2.0(transitive)
+ Addedlodash._basecopy@3.0.1(transitive)
+ Addedlodash._basefor@3.0.3(transitive)
+ Addedlodash._bindcallback@3.0.1(transitive)
+ Addedlodash._createassigner@3.1.1(transitive)
+ Addedlodash._getnative@3.9.1(transitive)
+ Addedlodash._isiterateecall@3.0.9(transitive)
+ Addedlodash.assign@3.2.0(transitive)
+ Addedlodash.isarguments@3.1.0(transitive)
+ Addedlodash.isarray@3.0.4(transitive)
+ Addedlodash.isplainobject@3.2.0(transitive)
+ Addedlodash.keys@3.1.2(transitive)
+ Addedlodash.keysin@3.0.8(transitive)
+ Addedlodash.restparam@3.6.1(transitive)