You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
CursorPaginatedResponse<Element> — a Content-conforming wrapper
around CursorPaginator that renders a JSON envelope with data, links, and meta keys.
CursorPaginator.makeResponse() -> CursorPaginatedResponse<Element> —
converts a paginator into a response with the same element type. Use it
when you want a structured JSON response instead of returning the
paginator directly.
CursorPaginator.responding(with:) -> CursorPaginatedResponse<T> —
maps paginated items through a transform closure and returns a response
with a different element type. This is the recommended way to return
paginated results when your route uses a DTO instead of the raw model.
Cursor metadata — links, hasMore, cursor strings — is derived from the
model-level paginator and is unaffected by the transform.
Example
app.get("users"){ req ->CursorPaginatedResponse<UserResponse>intryawaitUser.query(on: req.db).sort(\.$id).cursorPaginate(perPage:20, on: req).responding{ user inUserResponse(id: user.id, displayName: user.name.capitalized)}}