neo4j / cypher-builder

A library for building Cypher queries for Neo4j programmatically.
https://neo4j.github.io/cypher-builder/
Apache License 2.0
50 stars 14 forks source link

How i can disable \n on build query? #392

Open bekkazy-k opened 2 months ago

bekkazy-k commented 2 months ago
  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();

My result:

MATCH (this0:Movie)
WHERE this0.title = $param0
RETURN this0.title

I need

MATCH (this0:Movie) WHERE this0.title = $param0 RETURN this0.title
angrykoala commented 2 months ago

Hi @bekkazy-k

This is not supported at the moment. I'll discuss with the rest of the team if this is a feature we want to add to Cypher Builder

In the meantime, a workaround would be to replace \n with " " in the returned string. I'm unsure if this would break the generated Cypher in some cases