-
Notifications
You must be signed in to change notification settings - Fork 147
feat: Distinct operator for queries #244
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
Conversation
🦋 Changeset detectedLatest commit: d24f71e The changes in this PR will be included in the next version bump. This PR includes changesets to release 6 packages
Not sure what this means? Click here to learn what changesets are. Click here if you're a maintainer who wants to add another changeset to this PR |
|
@tanstack/db-example-react-todo @tanstack/db
@tanstack/electric-db-collection
@tanstack/query-db-collection
@tanstack/react-db
@tanstack/vue-db
commit: |
samwillis
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is great!
We should add a test to validate the behaviour when there is no select. We either support that, or don't. If it doesn't worth with no select it should throw an error when you try to use without a select. (I think it should work)
|
@kevin-dp note that I bumped d2mini on your branch after releasing it. CI is green 😁 |
Yes distinct without select works. There's a test for that here: https://github.com/TanStack/db/pull/244/files#diff-92b5216ddf806ff91a92eeda5701f1093a170697b0328f3297f31ae30d2cde7bR180-R189 |
|
If not useful should we just disallow it? |
|
Yep, let's require a select with a distinct. It make it much more explicit what it is doing - fewer foot guns. |
|
@KyleAMathews @samwillis i added an explicit check to disallow DISTINCT without a SELECT and modified the corresponding unit test accordingly. |
samwillis
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🚢
KyleAMathews
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
![]()
Co-authored-by: Sam Willis <sam.willis@gmail.com>
This PR adds support for a SQL-like
distinctoperator on queries.It works on top of electric-sql/d2ts#80 so we need to wait until that PR is merged and a new version of d2mini is released. Until then CI will be red.