[FEAT] Filters Omnibus - #33
Merged
Merged
Conversation
quantified comparisons. It also adds trusted subquery support, stronger cloning and clearing behavior, and expanded documentation and tests. Changes: - Make Filter.Where and WhereGroup.Where append conditions with AND. - Add ReplaceWhere, ClearWhere, and Clear. - Add NOT IN support and correct empty IN/NOT IN behavior. - Add Any(op) and All(op) comparisons. - Add trusted Subquery and Subselect support, including SELECT/WITH strings. - Ensure Clone creates an independent copy. - Add focused unit tests and PostgreSQL array integration coverage. - Update package documentation, public aliases, README.md, and test comments. - Remove deprecated public filter APIs and aliases.
bbengfort
approved these changes
Sep 3, 2026
bbengfort
left a comment
Contributor
There was a problem hiding this comment.
I read through this pretty well - everything looks very well implemented. These operators will certainly be very helpful and are going a long way to make tidal a more complete database helper tool!
| return fmt.Sprintf("%s %s %s", n.field, n.op, sym) | ||
| } | ||
| fallthrough | ||
| fallthrough // non-literal values render "field op value" |
Contributor
There was a problem hiding this comment.
I really have to use fallthrough more -- I forgot that was a thing lol.
Contributor
Author
There was a problem hiding this comment.
Yea! I liked it here but it's a bit of a niche tool
This file contains hidden or 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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Scope of changes
This PR improves filter composition and adds safer handling for list and quantified comparisons. It also adds trusted subquery support, stronger cloning and clearing behavior, and expanded documentation and tests.
Changes:
Filter.WhereandWhereGroup.Whereappend conditions withAND.ReplaceWhere,ClearWhere, andClear.NOT INsupport and correct emptyIN/NOT INbehavior.Any(op)andAll(op)comparisons.SubqueryandSubselectsupport, includingSELECT/WITHstrings.Clonecreates an independent copy.README.md, and test comments.Fixes SC-40490
Fixes SC-39883
Fixes SC-39711
Estimated PR Size:
Acceptance criteria
NOTE: Most of this code is still "user beware" so the user must ensure their queries remain valid. For the filters, specifically, it is possible for the user to do things with WHERE, such as the new ANY and ALL op builder funcs, that can result in invalid SQL. In one instance, the builder just emits some invalid SQL when a user combines invalid operations. Unless we want to use a sum type which encapsulates a value and error at the same time there really isn't a good way to validate filter building, so it's simpler just to let the user deal with knowing/learning invalid combinations.
Author checklist