Skip to content

Commit

Permalink
Fix Sort order
Browse files Browse the repository at this point in the history
  • Loading branch information
tomleb committed Jan 16, 2025
1 parent 797f66d commit 9065bc3
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions pkg/stores/sqlpartition/listprocessor/processor.go
Original file line number Diff line number Diff line change
Expand Up @@ -91,20 +91,20 @@ func ParseQuery(apiOp *types.APIRequest, namespaceCache Cache) (informer.ListOpt
sortParts := strings.SplitN(sortKeys, ",", 2)
primaryField := sortParts[0]
if primaryField != "" && primaryField[0] == '-' {
sortOpts.PrimaryOrder = informer.DESC
sortOpts.Orders = append(sortOpts.Orders, informer.DESC)
primaryField = primaryField[1:]
}
if primaryField != "" {
sortOpts.PrimaryField = strings.Split(primaryField, ".")
sortOpts.Fields = append(sortOpts.Fields, strings.Split(primaryField, "."))
}
if len(sortParts) > 1 {
secondaryField := sortParts[1]
if secondaryField != "" && secondaryField[0] == '-' {
sortOpts.SecondaryOrder = informer.DESC
sortOpts.Orders = append(sortOpts.Orders, informer.DESC)
secondaryField = secondaryField[1:]
}
if secondaryField != "" {
sortOpts.SecondaryField = strings.Split(secondaryField, ".")
sortOpts.Fields = append(sortOpts.Fields, strings.Split(secondaryField, "."))
}
}
}
Expand Down

0 comments on commit 9065bc3

Please sign in to comment.