This repository was archived by the owner on May 13, 2023. It is now read-only.
Support sorting by multiple columns #31
Merged
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.
What kind of change does this PR introduce?
Align the functionality of
order()
with that of postgres-js by adding the same new feature.This closes #30 .
What is the current behavior?
Sorting by multiple columns is not supported.
What is the new behavior?
Multiple
order()
s can be used together to sort records by multiple columns. See #30 for details.Additional context
It looks like transforms_test.dart does not follow the
lines_longer_than_80_chars
linter rule, so I didn't rundart format
on the file.I fixed one of the existing tests too.
postgrest-dart/test/resource_embedding_test.dart
Lines 30 to 40 in c8a1908
This is the test code before my fix. It only checked the number of results without checking the order, which was not appropriate as a test for sorting.
I ignored the equivalent tests in postgres-js because they don't make sure that sort results are as expected.
https://github.com/supabase/postgrest-js/blob/e5f5dfae7da22f4ff63c11c124d65d0699b7b890/test/transforms.ts#L10-L17
https://github.com/supabase/postgrest-js/blob/e5f5dfae7da22f4ff63c11c124d65d0699b7b890/test/resource-embedding.ts#L41-L48
The
messages
table has two records with the same username ("supabot"), so sorting by the column does not mean the expected behaviour is correctly tested. I think these should be fixed.