thedevsaddam / gojsonq

A simple Go package to Query over JSON/YAML/XML/CSV Data
https://github.com/thedevsaddam/gojsonq/wiki
MIT License
2.17k stars 140 forks source link

Unable to sort multiple fields with OrderBy #94

Open sancho21 opened 2 years ago

sancho21 commented 2 years ago

Supposed that we have list of objects which have internalScore and externalScore. OrderBy can only sort one field only, either those two. If there are 2 records having the same internalScore, when it's already sorted by internalScore, then externalScore cannot be sorted. So, at the moment OrderBy cannot do this.

I wish it allowed us to call OrderBy multiple times which adds up instead of overriding it.

It's similar to SQL functionality:

SELECT * FROM tbl_Employee ORDER BY lastName ASC, Salary DESC