@neo4j/cypher-builder
Version:
A programmatic API for building Cypher queries for Neo4j
54 lines (36 loc) • 1.64 kB
Markdown
[](https://www.npmjs.com/package/@neo4j/cypher-builder)
[](https://github.com/neo4j/cypher-builder/actions/workflows/test.yml)
[](https://github.com/neo4j/cypher-builder/actions/workflows/lint.yml)
Cypher Builder is a JavaScript programmatic API to create [Cypher](https://neo4j.com/docs/cypher-manual/current/) queries for [Neo4j](https://neo4j.com/).
- [Documentation](https://neo4j.github.io/cypher-builder/cypher-builder/current/)
```typescript
import Cypher from "@neo4j/cypher-builder";
const movieNode = new Cypher.Node();
const pattern = new Cypher.Pattern(movieNode, { labels: ["Movie"] });
const matchQuery = new Cypher.Match(pattern)
.where(movieNode, {
title: new Cypher.Param("The Matrix"),
})
.return(movieNode.property("title"));
const { cypher, params } = matchQuery.build();
console.log(cypher);
console.log(params);
```
_Cypher_
```cypher
MATCH (this0:Movie)
WHERE this0.title = $param0
RETURN this0.title
```
_Params_
```typescript
{
"param0": "The Matrix",
}
```
See our [contributing guide](./CONTRIBUTING.md) for development instructions.
You can find usage examples in the [examples](https://github.com/neo4j/cypher-builder/tree/main/examples) folder.
> This library is for JavaScript and TypeScript only. If you are using Java, check [Neo4j Cypher DSL](https://neo4j.github.io/cypher-dsl).