Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

Bind query params per .cql file #91

Open
jasperblues opened this issue Nov 3, 2018 · 2 comments
Open

Bind query params per .cql file #91

jasperblues opened this issue Nov 3, 2018 · 2 comments

Comments

@jasperblues
Copy link

jasperblues commented Nov 3, 2018

@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.

@ex3m1024
Copy link
Contributor

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!

@jasperblues
Copy link
Author

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

# for free to join this conversation on GitHub. Already have an account? # to comment
Projects
None yet
Development

No branches or pull requests

2 participants