-
Notifications
You must be signed in to change notification settings - Fork 35
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(QueryBuilder): Automatic where scoping with OR clauses in when c…
…allbacks When calling additional QueryBuilder methods inside a `when` callback, it is easy to forget that those changes, while in a closure, are not in a where group or scope (meaning parenthesis around the statements). This commit automatically scopes where clauses inside a `when` callback, but only if an OR combinator was used. This ignores any additional nested queries inside the `when` callback. This can be turned off using a new fourth parameter, `withoutScoping`. A `withScoping` method is publicly available for downstream libraries like Quick to utilize this scoping feature in additional ways, like Quick scopes or additional QuickBuilder methods. BREAKING CHANGE: Where statements added inside a `when` callback will be automatically scoped if the callback adds any statements with an OR combinator. This change will not likely break any of your code, but it is technically a breaking change.
- Loading branch information
Showing
3 changed files
with
176 additions
and
52 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,62 +1,56 @@ | ||
{ | ||
"name":"qb", | ||
"version":"7.10.0", | ||
"author":"Eric Peterson", | ||
"homepage":"https://github.com/coldbox-modules/qb", | ||
"documentation":"https://github.com/coldbox-modules/qb", | ||
"location":"forgeboxStorage", | ||
"scripts":{ | ||
"generateAPIDocs":"rm .tmp --recurse --force && docbox generate mapping=qb excludes=test|ModuleConfig strategy-outputDir=.tmp/apidocs strategy-projectTitle=qb", | ||
"commitAPIDocs":"run-script generateAPIDocs && !git add docs/apidocs/* && !git commit -m 'Updated API Docs'", | ||
"format":"cfformat run models/**/*.cfc,tests/resources/**/*.cfc,tests/specs/**/*.cfc --overwrite", | ||
"format:check":"cfformat check models/**/*.cfc,tests/resources/**/*.cfc,tests/specs/**/*.cfc" | ||
"name": "qb", | ||
"version": "7.10.0", | ||
"author": "Eric Peterson", | ||
"homepage": "https://github.com/coldbox-modules/qb", | ||
"documentation": "https://github.com/coldbox-modules/qb", | ||
"location": "forgeboxStorage", | ||
"scripts": { | ||
"generateAPIDocs": "rm .tmp --recurse --force && docbox generate mapping=qb excludes=test|ModuleConfig strategy-outputDir=.tmp/apidocs strategy-projectTitle=qb", | ||
"commitAPIDocs": "run-script generateAPIDocs && !git add docs/apidocs/* && !git commit -m 'Updated API Docs'", | ||
"format": "cfformat run models/**/*.cfc,tests/resources/**/*.cfc,tests/specs/**/*.cfc --overwrite", | ||
"format:check": "cfformat check models/**/*.cfc,tests/resources/**/*.cfc,tests/specs/**/*.cfc" | ||
}, | ||
"repository":{ | ||
"type":"git", | ||
"URL":"https://github.com/coldbox-modules/qb" | ||
"repository": { | ||
"type": "git", | ||
"URL": "https://github.com/coldbox-modules/qb" | ||
}, | ||
"bugs":"https://github.com/coldbox-modules/qb/issues", | ||
"slug":"qb", | ||
"shortDescription":"A query builder for the rest of us", | ||
"type":"modules", | ||
"keywords":[ | ||
"bugs": "https://github.com/coldbox-modules/qb/issues", | ||
"slug": "qb", | ||
"shortDescription": "A query builder for the rest of us", | ||
"type": "modules", | ||
"keywords": [ | ||
"ORM", | ||
"query", | ||
"SQL" | ||
], | ||
"private":false, | ||
"projectURL":"https://github.com/coldbox-modules/qb", | ||
"license":[ | ||
"private": false, | ||
"projectURL": "https://github.com/coldbox-modules/qb", | ||
"license": [ | ||
{ | ||
"type":"MIT", | ||
"URL":"https://github.com/coldbox-modules/qb/LICENSE" | ||
"type": "MIT", | ||
"URL": "https://github.com/coldbox-modules/qb/LICENSE" | ||
} | ||
], | ||
"dependencies":{ | ||
"cbpaginator":"^2.0.0" | ||
"dependencies": { | ||
"cbpaginator": "^2.0.0" | ||
}, | ||
"devDependencies":{ | ||
"testbox":"^3.0.0" | ||
"devDependencies": { | ||
"testbox": "^3.0.0" | ||
}, | ||
"installPaths":{ | ||
"testbox":"testbox/", | ||
"cbpaginator":"modules/cbpaginator/" | ||
"installPaths": { | ||
"testbox": "testbox/", | ||
"cbpaginator": "modules/cbpaginator/" | ||
}, | ||
"ignore":[ | ||
"ignore": [ | ||
"**/.*", | ||
"test", | ||
"tests", | ||
"docs/**/*.*", | ||
"server.json" | ||
], | ||
"testbox":{ | ||
"runner":"http://localhost:7777/tests/runner.cfm", | ||
"verbose":false | ||
}, | ||
"githooks":{ | ||
"preCommit":[ | ||
"cfformat run `!git diff --name-only --staged` --overwrite", | ||
"!git add `git diff --name-only --staged`" | ||
] | ||
"testbox": { | ||
"runner": "http://localhost:7777/tests/runner.cfm", | ||
"verbose": false | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters