sedk-neo4j
Version:
Cypher builder and validator for Neo4j
51 lines (39 loc) • 1.51 kB
Markdown

[](https://opensource.org/licenses/ISC)
[](https://codecov.io/gh/amerharb/sedk-neo4j)
SEDK-neo4j is a Cypher builder library for Neo4j, support binding parameters, and use a pre-defined Label and Relation
```typescript
import * as sedk from 'sedk-neo4j'
const database = {
Labels: {
Person: new sedk.Label('Person'),
Animal: new sedk.Label('Animal'),
}
}
//Aliases
const Person = database.Labels.Person
const Animal = database.Labels.Animal
const n = new sedk.Variable('n')
const cypher = sedk.builder()
const stmt = cypher.match(n, Person).return(n).getCypher()
// MATCH (`n`:`Person`) RETURN `n`
```

- use A `ASTERISK` in return step
```typescript
cypher.match(n, Person).return(ASTERISK).getCypher()
// MATCH (`n`:`Person`) RETURN *
```
- multi label for the same node
```typescript
cypher.match(n, Person, Student).return(ASTERISK).getCypher()
// MATCH (`n`:`Person`:`Student`) RETURN *
```
- Add backtick to generated label and variable names
THIS IS STILL A WORK IN PROGRESS FOR PROF OF CONCEPT PROJECT.
USE IT FOR EDUCATION PURPOSE ONLY.