[feature] #2553: Add sorting to queries
Signed-off-by: Vladimir Pesterev [email protected]
Description of the Change
I've added sorting parameter into ISI queries.
The sorting will apply only to entities that have metadata.
- [x] Minimal representation of this feature.
- [x] Implement for all queries.
- [x] More tests.
Issue
Resolves #2553
Benefits
Allows to sort the result of queries
Possible Drawbacks
None.
Codecov Report
Merging #2575 (533af1d) into iroha2-dev (a16d9c3) will decrease coverage by
2.15%. The diff coverage is64.79%.
:exclamation: Current head 533af1d differs from pull request most recent head 0d4ae2d. Consider uploading reports for the commit 0d4ae2d to get more accurate results
@@ Coverage Diff @@
## iroha2-dev #2575 +/- ##
==============================================
- Coverage 67.61% 65.45% -2.16%
==============================================
Files 140 157 +17
Lines 26173 28303 +2130
==============================================
+ Hits 17696 18526 +830
- Misses 8477 9777 +1300
| Impacted Files | Coverage Δ | |
|---|---|---|
| cli/derive/src/lib.rs | 74.72% <ø> (ø) |
|
| cli/src/torii/mod.rs | 28.88% <ø> (ø) |
|
| client_cli/src/main.rs | 0.26% <ø> (ø) |
|
| config/base/src/runtime_upgrades.rs | 35.63% <ø> (ø) |
|
| core/src/block.rs | 70.00% <ø> (ø) |
|
| core/src/queue.rs | 95.67% <ø> (-0.08%) |
:arrow_down: |
| core/src/smartcontracts/isi/asset.rs | 54.82% <ø> (ø) |
|
| core/src/sumeragi/message.rs | 8.20% <0.00%> (ø) |
|
| core/src/sumeragi/mod.rs | 0.00% <ø> (ø) |
|
| core/test_network/src/lib.rs | 28.81% <0.00%> (-19.17%) |
:arrow_down: |
| ... and 161 more |
Help us with your feedback. Take ten seconds to tell us how you rate us. Have a feature suggestion? Share it here.
@mversic
- Depends on prioritization. Currently, it seems we don't have the resources for that.
- I suppose that the right decision is to add a middleware that will sort the results of queries by specific parameters and cache them. The current decision is temporary and makes it possible to use the sorting feature.
@appetrosyan I've moved the sorting to torii handler but it sorts only assets-related queries.
@appetrosyan
These should be extracted into their own query crate: Pagination, Predicate, Sorting and the queries themselves.
The suggestion to move queries to a separate crate looks non-trivial, and I think it will be done in a new issue.