simolus3 / drift

Drift is an easy to use, reactive, typesafe persistence library for Dart & Flutter.
https://drift.simonbinder.eu/
MIT License
2.65k stars 372 forks source link

Use .distinct() by default for streams #3295

Open dickermoshe opened 3 weeks ago

dickermoshe commented 3 weeks ago

title says it all

RoarGronmo commented 3 weeks ago

I strongly agree !!

You could add an indistinct() method if you want it to do a call for every db update regardless of "real" changes or not.

RoarGronmo commented 1 week ago

BTW: Are we sure that the distinct function will catch if there are similarities. I have situations now, in not too complex datasets that the distinct comparison "fails", so I need to provide with "manual" comparing of the datasets to be sure of the outcome. If drift could somehow provide the comparators of the datasets, it would have been very convenient.

The "failed" comparisons, seems to be produced on datasets where there are joins or partly selections in the queries.

So this could be most gracefully fixed by providing the comparators of the resulting objects in queries with joines and partly selections.

RoarGronmo commented 1 week ago

I may post a suggestion that there should be produced comparators on more complex queries...

RoarGronmo commented 1 week ago

If you enables the override_hash_and_equals_in_result_sets option, it will be even better...

See #3326