I'm using Drivine, with Neo4j. The example shows how to inject a query stored in a separate file. How can I simply inline a query as a string?
The idea behind having a separate file is so that queries can be profiled, tested and have a life-cyle in their own right. You don't have to use this if it doesn't suit you.
The example also shows how to create inline queries:
async countAllVertices(): Promise<number> {
const results = await this.persistenceManager.query<any>(
new QuerySpecification(`match (n) return count(n) as count`)
);
return results[0].count;
}
For simple queries that don't need to be profiled or heavily tested, inline is easier.