Skip to content

Adding HAVING clause support to generic query generator#1286

Merged
mickhansen merged 7 commits intosequelize:masterfrom
OtaK:master
Jan 24, 2014
Merged

Adding HAVING clause support to generic query generator#1286
mickhansen merged 7 commits intosequelize:masterfrom
OtaK:master

Conversation

@OtaK
Copy link
Copy Markdown

@OtaK OtaK commented Jan 24, 2014

Hi guys, hi @sdepold,

As I needed it, I added HAVING clause support to Sequelize's generic query generator.

Do I need to provide unit tests or is it okay like that ?

HOW TO USE

As the specification says, HAVING clauses are syntactically the same as WHERE clauses.
So in your Model.findAll() for example, provide a having option in the hash.

Like this :

Model.findAll({
    ...
    having: { myField: { gt: 600 } },
    ...
}).success(...).error(...);

@mickhansen
Copy link
Copy Markdown
Contributor

Please do provide unit tests when introducing new functionality, else we will have no clue if we break it later on.

@OtaK
Copy link
Copy Markdown
Author

OtaK commented Jan 24, 2014

Just pushed some commits with bugfixes, improvements, code style, and unit tests :)

@mickhansen
Copy link
Copy Markdown
Contributor

Great stuff, i see you added tests to mysql query generator, mind adding to sqlite and postgres aswell? :)

@OtaK
Copy link
Copy Markdown
Author

OtaK commented Jan 24, 2014

Here it is for you :-)

@mickhansen
Copy link
Copy Markdown
Contributor

Ah, we merged some work in the meanwhile, mind rebasing? I cant merge automatically.

Mathieu Amiot added 2 commits January 24, 2014 15:54
Conflicts:
	lib/dialects/abstract/query-generator.js
@OtaK
Copy link
Copy Markdown
Author

OtaK commented Jan 24, 2014

Just pushed the merge. Let's wait for Travis to complete the build.

@mickhansen
Copy link
Copy Markdown
Contributor

Sweet :)

@mickhansen
Copy link
Copy Markdown
Contributor

Mind adding a small doc to the original description of this PR describing how to use it?

mickhansen added a commit that referenced this pull request Jan 24, 2014
Adding HAVING clause support to generic query generator
@mickhansen mickhansen merged commit 0cd08d9 into sequelize:master Jan 24, 2014
@OtaK
Copy link
Copy Markdown
Author

OtaK commented Jan 24, 2014

@mickhansen Done. Does it look okay for you?

@mickhansen
Copy link
Copy Markdown
Contributor

@OtaK Perfect! Thank you for your work.

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