graphql2cypher
v3.0.6
Published
simple graphql to cypher
Downloads
9
Readme
graphql2cypher
Naive parser from graphql to cypher query.
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