Rekord icon indicating copy to clipboard operation
Rekord copied to clipboard

Add option to allow to specify keys for sorting

Open jukecraft opened this issue 8 years ago • 3 comments

It would be lovely to have the ability to specify which fields to use when sorting rekords - basically implementing the Comparable interface

jukecraft avatar Aug 09 '16 11:08 jukecraft

Would it make more sense to preserve either insertion order or accepting construction order?

SamirTalwar avatar Aug 09 '16 11:08 SamirTalwar

I'm not sure what you mean. My example is that I load a forecast (consisting of date and expectedValue) from the database and put it in a list, then transform it to the rekord object and return it in an API response. The forecasts should be sorted by date.

I currently use a Forecast object that overrides compareTo using the date, but I'd like to replace that with a rekord.

jukecraft avatar Aug 09 '16 11:08 jukecraft

Ah, I see, makes sense. It would probably make sense to wrap it in a ComparableRekord. Will think about it.

SamirTalwar avatar Aug 09 '16 12:08 SamirTalwar