Skip to content
New issue

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

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

Already on GitHub? Sign in to your account

Added ability to pass custom SQL queries into find methods. #259

Merged
merged 1 commit into from
Oct 24, 2018

Conversation

adrians5j
Copy link
Member

@adrians5j adrians5j commented Oct 24, 2018

Example:

await SimpleEntity.count({
            sql: {
                query: "SELECT COUNT(*) FROM `SimpleEntity` WHERE age > ? OR type = ?",
                values: [20, "developer"]
            },
            groupBy: ["something"]
        });

Note that in this example groupBy will totally be ignored, because the custom sql was passed.

This behavior is supported by find, findOne and count methods.

@adrians5j adrians5j self-assigned this Oct 24, 2018
@adrians5j adrians5j merged commit b9f51bb into development Oct 24, 2018
@adrians5j adrians5j deleted the entity/directSql branch October 24, 2018 15:18
@coveralls
Copy link

Coverage Status

Coverage decreased (-0.01%) to 95.028% when pulling 4c097ed on entity/directSql into 7b14708 on development.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants