I’m trying to add pagination to the resources.
There’s an action for the ResourceA
read :list do
pagination(keyset?: true, default_limit: 1, countable: true)
end
Calling API.read_all!(ResourceA)
returns all 10+ records from db.
Calling ResourceA.list!()
, I get the following result:
%Ash.Page.Keyset{
results: [
#ResourceA<
__meta__: #Ecto.Schema.Metadata<:loaded, "patios">,
id: "37d49fa9-d8d1-4288-b9c0-57a1a2be77b7",
inserted_at: ~U[2024-02-07 13:38:58.000000Z],
updated_at: ~U[2024-02-07 13:38:58.000000Z],
aggregates: %{},
calculations: %{},
...
>
],
count: nil,
before: nil,
after: nil,
limit: 1,
rerun: {#Ash.Query<
resource: ResourceA,
sort: [id: :asc],
limit: 251,
select: [:id, :inserted_at, :updated_at]
>,
[
page: [limit: 1],
verbose?: false,
actor: nil,
authorize?: false,
return_query?: false
]},
more?: true
}
Calling ResourceA.list!(page: [limit: 1])
, I get the following result:
%Ash.Page.Keyset{
results: [
#ResourceA<
__meta__: #Ecto.Schema.Metadata<:loaded, "patios">,
id: "37d49fa9-d8d1-4288-b9c0-57a1a2be77b7",
inserted_at: ~U[2024-02-07 13:38:58.000000Z],
updated_at: ~U[2024-02-07 13:38:58.000000Z],
aggregates: %{},
calculations: %{},
...
>
],
count: nil,
before: nil,
after: nil,
limit: 1,
rerun: {#Ash.Query<
resource: ResourceA,
sort: [id: :asc],
limit: 2,
select: [:id, :inserted_at, :updated_at]
>,
[
page: [limit: 1],
verbose?: false,
actor: nil,
authorize?: false,
return_query?: false
]},
more?: true
}
Why am I not getting the “before” and “after” cursors? What am I doing wrong?
Thanks.