mirror of
https://github.com/bitechdev/ResolveSpec.git
synced 2025-11-13 18:03:53 +00:00
Empty sort appended bug fix
This commit is contained in:
parent
f0e26b1c0d
commit
7f5b851669
@ -293,6 +293,9 @@ func (h *Handler) handleRead(ctx context.Context, w common.ResponseWriter, id st
|
|||||||
logger.Debug("Applying expand: %s", expand.Relation)
|
logger.Debug("Applying expand: %s", expand.Relation)
|
||||||
sorts := make([]common.SortOption, 0)
|
sorts := make([]common.SortOption, 0)
|
||||||
for _, s := range strings.Split(expand.Sort, ",") {
|
for _, s := range strings.Split(expand.Sort, ",") {
|
||||||
|
if s == "" {
|
||||||
|
continue
|
||||||
|
}
|
||||||
dir := "ASC"
|
dir := "ASC"
|
||||||
if strings.HasPrefix(s, "-") || strings.HasSuffix(strings.ToUpper(s), " DESC") {
|
if strings.HasPrefix(s, "-") || strings.HasSuffix(strings.ToUpper(s), " DESC") {
|
||||||
dir = "DESC"
|
dir = "DESC"
|
||||||
@ -1531,6 +1534,9 @@ func (h *Handler) FetchRowNumber(ctx context.Context, tableName string, pkName s
|
|||||||
if len(options.Sort) > 0 {
|
if len(options.Sort) > 0 {
|
||||||
sortParts := make([]string, 0, len(options.Sort))
|
sortParts := make([]string, 0, len(options.Sort))
|
||||||
for _, sort := range options.Sort {
|
for _, sort := range options.Sort {
|
||||||
|
if sort.Column == "" {
|
||||||
|
continue
|
||||||
|
}
|
||||||
direction := "ASC"
|
direction := "ASC"
|
||||||
if strings.EqualFold(sort.Direction, "desc") {
|
if strings.EqualFold(sort.Direction, "desc") {
|
||||||
direction = "DESC"
|
direction = "DESC"
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user