Pagination using limit and offset query parameters

未关闭
#5 14 条评论 0 个 reaction 已指派 0 人 在 GitHub 查看

还没有人认领这个 Issue。

评估

难度
4/5
预计耗时
3-5 天
新手友好度
35/100
Issue 类型
功能
描述清晰度
基本清楚
活跃度
停滞
技术栈
elixir
领域
api

调研方向

首先跟踪 issue 中所示的现有 limit_with {:param, "limit"} 入口点和 read(:list_companies) action。检查查询参数如何变成资源参数或过滤器,然后确定应如何表示 offset/skip;完成的标准是 API 无需当前的过滤器变通方案即可获取后续页面。

由索引模型根据 Issue 内容生成。

描述

I have an API that achieves pagination using query parameters in the URL. The maximum items returned is 50 so an offset/skip is needed to retrieve the full dataset

Is this possible using the library as-is? I have hacked it for now by adding a "skip" parameter to the resource that gets passed as a filter

read(:list_companies) do
    argument :skip, :integer do
        allow_nil? true
        default 0
    end

    filter expr(skip == ^arg(:skip))
end

The limit is working nicely as-is:

limit_with {:param, "limit"}
主要语言
Elixir
星标
28
派生
13
平均合并
8 小时 1 分钟
30 天内合并 PR
2

环境准备

  • 没有 Dockerfile 或 Docker Compose 文件
  • 没有 Pull Request 模板
  • 阅读贡献指南

从这里开始

  1. 先读完整个 Issue,再读项目的贡献指南。
  2. 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
  3. Fork 仓库,在一个分支上完成修改。
  4. 提交 Pull Request,并在描述里引用这个 Issue 编号。

ash-project/ash_json_api_wrapper 的其他 Issue

查看 ash-project/ash_json_api_wrapper 的全部 Issue

相似的 Issue

更多 Elixir Issue

把新 issue 发到你的邮箱

精选适合新手参与的 GitHub issue 摘要。