Chunkr.Page (Chunkr v0.2.0) View Source

A single page of results.

Fields

  • raw_results — rows in the form {cursor_values, record} where cursor_values is the list of values to be used for generating a cursor. Note that in cases where coalescing or other manipulation was performed for the sake of pagination, the cursor values will reflect that manipulation, while the record itself will by default not.
  • has_previous_page — whether or not there is a previous page of results.
  • has_next_page — whether or not there is a subsequent page of results.
  • start_cursor — a cursor representing the first record in this page of results.
  • end_cursor — a cursor representing the last record in this page of results.
  • opts — opts used.

Link to this section Summary

Functions

Returns opaque cursors with their corresponding records.

Extracts just the records out of the raw results.

Fetches the total, non-paginated count of records that match the query.

Link to this section Types

Specs

record() :: any()

Specs

t() :: %Chunkr.Page{
  end_cursor: Chunkr.Cursor.opaque_cursor() | nil,
  has_next_page: boolean(),
  has_previous_page: boolean(),
  opts: Chunkr.Opts.t(),
  raw_results: [{Chunkr.Cursor.cursor_values(), record()}],
  start_cursor: Chunkr.Cursor.opaque_cursor() | nil
}

Link to this section Functions

Link to this function

cursors_and_records(page)

View Source

Specs

cursors_and_records(t()) :: [{Chunkr.Cursor.opaque_cursor(), any()}]

Returns opaque cursors with their corresponding records.

Specs

records(t()) :: [any()]

Extracts just the records out of the raw results.

Specs

total_count(t()) :: integer()

Fetches the total, non-paginated count of records that match the query.

Counting the total number of records requires an extra database query, so this is not performed by default.