graphql2cypher

3.0.6 • Public • Published

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

Readme

Keywords

Package Sidebar

Install

npm i graphql2cypher

Weekly Downloads

1

Version

3.0.6

License

MIT

Last publish

Collaborators

  • jameskyburz