Skip to content

Instantly share code, notes, and snippets.

@bugs181
Last active June 18, 2017 11:39
Show Gist options
  • Save bugs181/dc69dd70c086ab83f5200e48d3fa63f8 to your computer and use it in GitHub Desktop.
Save bugs181/dc69dd70c086ab83f5200e48d3fa63f8 to your computer and use it in GitHub Desktop.
Example of using Leto
const leto = require('Leto')
let leto = new Leto()
leto
.use('neo4j') // Synonymous with require(), but does some special processing.
.connect({ user, pass, host }) // Pass in a config option for .connect() but has defaults too.
.create('Person', 'name') // Creates a label constraint on the name prop
.add(myPerson) // Add the myPerson object to neo4j. No Cypher syntax needed. ;)
.catch(err => console.log(`Error occured: ${err}`)
leto
.get(myPerson)
.results((err, results) => console.log(results))
// Optionally, each operation can have it's own callback.
leto
.get(myPerson, (err, results) => console.log(results))
@bugs181
Copy link
Author

bugs181 commented Jun 15, 2017

In response to a couple reddit questions:

I've been developing a library called Leto which would seriously help with flow control issues. It's not available yet but look forward to using it in the next coming weeks. The syntax is extremely easy to use and supports a plugin adapter type architecture to give you flow control for database/utilities backends.

Right now i've just been ironing out the syntax and looking for all the edge cases for database/utility operations and trying to cover them. Like ignoring errors for specific operations, giving you .else definitions for operations to execute in case an operation failed, etc.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment