This is a playground
to test code. It runs a full Node.js
environment and already has all of npm
’s 1,000,000+ packages pre-installed, including isomorphic-cypher
with all npm
packages installed. Try it out:
var IsomorphicCypher = require("isomorphic-cypher");
// Instantiate package
var inst = new IsomorphicCypher();
// Set parameters to apply to all queries (parameters are isomorphic, they are
// shared with the database and with the templating system on this side)
inst.parameters.breed = "Beagle";
inst.parameters.coat = "brown";
// Add a query, normally I'd use ES6 string templates to skip manual building
// but Tonic doesn't support them
inst.addQuery({
query: 'match (a:Dog:Post {username: "somebody12345"})\n' +
// Since all parameters are isomorphic, skip this and let the
// database handle it which is better
'set a.breed = {breed}\n' +
// Lets handle this one on this end before sending it to the
// database
'set a.breed = {{coat}}\n' +
// Lets handle this one on this end and escape it beforehand
'set a.title = {{{title}}}',
parameters: {
// Add a local parameter to this query only
title: ">> A Beagle <<"
}
});
// Can't execute without database connection
// inst.execute();
// Log what exactly will be sent to the database
console.log(inst.queryQueue.default[0].query);
This service is provided by RunKit and is not affiliated with npm, Inc or the package authors.