Fix improper unsortable error report construction

This commit is contained in:
Tomaž Jerman
2022-07-07 09:37:28 +02:00
parent f56d61070d
commit 937e5b5634
+3 -1
View File
@@ -314,13 +314,15 @@ func Order(sort filter.SortExprSet, sortables map[string]string) (oo []exp.Order
func order(sort filter.SortExprSet, sortables map[string]string) (oo []exp.OrderedExpression, err error) {
var (
has bool
col string
)
for _, s := range sort {
if len(sortables) > 0 {
if s.Column, has = sortables[strings.ToLower(s.Column)]; !has {
if col, has = sortables[strings.ToLower(s.Column)]; !has {
return nil, fmt.Errorf("column %q is not sortable", s.Column)
}
s.Column = col
}
if s.Descending {