jetbrains-plugin-graph-database-support icon indicating copy to clipboard operation
jetbrains-plugin-graph-database-support copied to clipboard

Bind query params per .cql file

Open jasperblues opened this issue 7 years ago • 2 comments

@Service()
export class OrganisationManager extends Object {

    constructor(@Inject("database") readonly db: BoltAdapter,
                @CypherQuery("organisationManager/get") readonly getQuery: string)   
                 ^--- Query is injected
    {
        super();
    }

    public async list(): Promise<Organisation[]> {
        const result = await this.db.query(this.getQuery);
        return plainToClass(Organisation, result.data);
    }
}

I'm working in TypeScript as follows:

  • TypeScript for code clarity and documentation of intent. Make the best use of OO and functional paradigm.
  • Uses routing controllers, dependency injection, and clean middleware (security concerns) for highly cohesive code that can scale to address complex requirements.
  • Using CYPHER pattern matching+projections then map query results w/ class transformers (https://github.com/typestack/class-transformer). A TypeScript class corresponds to a tuned query for a given use case or set thereof.

So using your amazing plugin we have:

  • Code-formatting and error checking on queries.
  • Execute and test, profile individually from within the IDE. Less context switching by jumping in and out of Neo console, but if we need to troubleshoot, we can copy/paste the query into neo profile quickly.

What would be cool is if we could query parameters to each .cql file individually. This way no need to update parameters as we test/modify/update individual queries for evolving use-case requirements.

jasperblues avatar Nov 03 '18 01:11 jasperblues

We have released version 2.5.6, which includes custom parameter support for each of the opened Cypher files, and much more. Please let us know if the implemented functionality is sufficient for your needs, or if there are must-haves you would like to request. Thanks!

ex3m1024 avatar Aug 19 '19 14:08 ex3m1024

@ex3m1024 Very cool, I'll give it a try tonight.

jasperblues avatar Aug 20 '19 04:08 jasperblues