graphql parser to cypher
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Failed to load latest commit information.
test
.gitignore
.travis.yml
LICENSE
index.js
package.json
readme.markdown
reduce.js

readme.markdown

graphql2cypher

Naive parser from graphql to cypher query.

js-standard-style build status Greenkeeper badge

main.js:

tape('user entity with address', (t) => {
  t.plan(2)
  parse(`
    user(id: <id>) {
      properties {
        name,
        address(edge: ":address", addressId: <addressId>) {
          properties {
            line
          }
        }
      }
    }
  `, (err, r) => {
    t.error(err)
    t.equals(r.cql, expected)
  })
  var expected = `
    match(user:user {id: {id}}) optional match(user)<-[:address]->(address:address {addressId: {addressId}})
    return *
  `
})

To see how reduce works to see how it looks check out fixtures, It works together with the module cypherquery

relationships, labels and graph

This requires that the statement sent to cypher has resultType ['row', 'graph']]

relationships

You can ask for relationships in graphql

`
    user(id: <id>) {
      relationships,
      ...
`

labels

You can ask for labels in graphql

`
    user(id: <id>) {
      labels
      ...
`

graph

You can ask for the raw graph as returned by cypher

`
    user(id: <id>) {
      graph
      ...
`

install

With npm do:

npm install graphql2cypher

test

npm test

license

MIT