Skip to content

Commit

Permalink
Merge pull request #56 from woylie/cursor-meta
Browse files Browse the repository at this point in the history
Cursor meta
  • Loading branch information
woylie authored Oct 14, 2020
2 parents 27dfead + 7fa4c31 commit 8150996
Show file tree
Hide file tree
Showing 2 changed files with 249 additions and 94 deletions.
7 changes: 3 additions & 4 deletions lib/flop.ex
Original file line number Diff line number Diff line change
Expand Up @@ -336,7 +336,6 @@ defmodule Flop do
def meta(
results,
%Flop{
after: after_,
first: first,
order_by: order_by,
before: nil,
Expand All @@ -354,8 +353,8 @@ defmodule Flop do
flop: flop,
start_cursor: start_cursor,
end_cursor: end_cursor,
has_next_page?: length(results) == first + 1,
has_previous_page?: !is_nil(after_)
has_next_page?: length(results) > first,
has_previous_page?: false
}
end

Expand All @@ -380,7 +379,7 @@ defmodule Flop do
flop: flop,
start_cursor: start_cursor,
end_cursor: end_cursor,
has_next_page?: true,
has_next_page?: false,
has_previous_page?: length(results) > last
}
end
Expand Down
Loading

0 comments on commit 8150996

Please sign in to comment.