feat: Distinct operator for queries#244
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.
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. |
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.