-
-
Notifications
You must be signed in to change notification settings - Fork 4.3k
feat: query builder #17937
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
base: v6
Are you sure you want to change the base?
feat: query builder #17937
Conversation
feat: query builder
Revert "feat: query builder"
Hi! Thanks for willing to work on sequelize. Unfortunately we won't be merging this to the v6 branch, we're not really accepting new features on there anymore. If you have a PR for the main branch we're happy to review it |
Hey @WikiRik, is there any way this could be an exception? This is something my team (and likely many others) need dearly, and to have to migrate to sequelize v7 (which is still in alpha) to get it would be a much more abrasive process. Having it only for v7 would also diminish a thousand times the impact of this feature. Regardless, if it's really a deal breaker, I can work on the v7 PR, as I was already going to do anyway. |
PR for v7 -> #17958 |
@yagodorea I didn't respond to your message yet. I think for v6 it might be better to publish a fork, since we have limited time to work on sequelize and I'd rather have that we spend the time to promote v7 to beta/stable and review open PRs for that than to also review v6 PRs. |
Pull Request Checklist
Description of Changes
Adds a simple query builder to sequelize static models. Basic functionality:
Model.select()
-> will instantiate the query builder for chaining.attributes(['a', 'b'])
-> select attributes.where({c: true, d: 1})
-> specify where conditions.getQuery()
-> return plain SQL.execute()
method that will run the raw sql instead of returning it.limit()
and.offset()
.orderBy([['a', 'DESC'], ['b', 'ASC']])
.groupBy(['a', 'b', 1, 2])
.having()
.andHaving()
.include()
with custom join logicFuture improvements/additions:
.andWhere
using Sequelize.where(col, op, value), Sequelize.literal() andWhereBrackets
as per proposal.orWhere
, block simultaneous usage with.andWhere
Disclaimer: history is kinda dirty because I accidentally merged the PR to the wrong branch, had to revert it and recreate it, but hopefully we can squash merge it 🙏