Generate Gremlin scripts with bound parameters using ES6 template strings
npm install gremlin-template-stringGenerate Gremlin scripts with bound parameters using ES6 template strings.
Gremlin is a graph database query language used by the Apache TinkerPop framework.
Read the full Gremlin/TinkerPop3 documentation there: http://www.tinkerpop.com/docs/current/
```
$ npm install gremlin-template-string --save
Run tests with:
``
$ npm test
The module exports a single function (tag expression) which allows you to tag an ES6 template template string.
It will return an object with two properties:
* script: an escaped Gremlin stringparams
* : a map (Object) of bound parameters (ie {p1: 'Foo', 'p2': 'Bar'})
`javascript
var gremlin = require('gremlin-template-string');
var who = 'Foobar';
var query = gremlin
g.V('name', ${who}).out('follows').name``
// query.script === "\n g.V('name', p1).out('follows').name\n"
// query.params.p1 === 'Foobar'
* easy multiline Gremlin queries
* syntax highlighting in IDE (Sublime Text)
* safer scripts (prevents Gremlin injections)
* faster scripts (bound parameters)
This library is heavily inspired by this blog post: http://www.ivc.com/blog/better-sql-strings-in-io-js-nodejs-part-2/. Thanks!
MIT