diff --git a/internal/pagination/service.go b/internal/pagination/service.go index 4f096f1..1c73ffb 100644 --- a/internal/pagination/service.go +++ b/internal/pagination/service.go @@ -229,6 +229,12 @@ func HandleURL(w http.ResponseWriter, r *http.Request) { } func HandleNonNumericCursor(w http.ResponseWriter, r *http.Request) { + vals, ok := r.URL.Query()["endCursor"] + var endCursor *string + if ok && len(vals) > 0 { + endCursor = &vals[0] + } + limit := 15 queryCursor := r.FormValue("cursor") @@ -249,10 +255,11 @@ func HandleNonNumericCursor(w http.ResponseWriter, r *http.Request) { res.ResultArray = append(res.ResultArray, unhash(i)) } - // output cursor to $.cursor in addition to $.resultArray[(@.length-1)] if len(res.ResultArray) == limit { cursor, _ := res.ResultArray[len(res.ResultArray)-1].(string) res.Cursor = &cursor + } else if endCursor != nil { + res.Cursor = endCursor } w.Header().Set("Content-Type", "application/json") @@ -262,6 +269,7 @@ func HandleNonNumericCursor(w http.ResponseWriter, r *http.Request) { } } + func HandleLimitOffsetDeepOutputsPage(w http.ResponseWriter, r *http.Request) { queryLimit := r.FormValue("limit") queryPage := r.FormValue("page")