cleishm / libcypher-parser

Cypher Parser Library
Apache License 2.0
147 stars 39 forks source link

Possible to reconstruct query #52

Closed teetering closed 5 months ago

teetering commented 5 months ago

Is it possible to take the parser output and reconstruct the query using that output?

In my use case I would like to allow my users to enter a query, but I would like to modify it on their behalf before finally querying the DB. Is this doable using this library, or am I barking up the wrong tree?

Thank you!

cleishm commented 5 months ago

In theory, yes. However, there is a lot of non-semantic information (like indentation) that you'd lose from the original text. Instead, you could use the position information in the parser output to modify the original query text rather than attempt to reconstruct that text entirely.