Chunkr.Opts (Chunkr v0.2.1) View Source

Options for paginating.

Fields

  • :repo — The Ecto.Repo for the query.
  • :planner — The module implementing the pagination strategy.
  • :query — The non-paginated query to be extended for pagination purposes.
  • :strategy — The name of the pagination strategy to use.
  • :sort_dir — The primary sort direction used for the query. Note that this aligns with the very first sort clause registered in the named pagination strategy. Any subsequent sort directions within the strategy will always be automatically adjusted to maintain the overall strategy.
  • :paging_dir — Either :forward or :backward depending on whether gathering results from the start or the end of the result set (i.e. whether the limit was specified as :first or :last).
  • :cursor — The :after or :before cursor beyond which results are retrieved.
  • :max_limit — The maximum allowed page size.
  • :limit — The requested page size (as specified by :first or :last).

Link to this section Summary

Functions

Validate provided options and return a Chunkr.Opts struct

Link to this section Types

Specs

sort_dir() :: :asc | :desc

Specs

t() :: %Chunkr.Opts{
  cursor: Chunkr.Cursor.opaque_cursor() | nil,
  limit: pos_integer(),
  max_limit: pos_integer(),
  paging_dir: :forward | :backward,
  planner: atom(),
  query: Ecto.Query.t(),
  repo: atom(),
  sort_dir: sort_dir(),
  strategy: atom()
}

Link to this section Functions

Link to this function

new(query, strategy, sort_dir, opts)

View Source

Specs

new(any(), any(), sort_dir(), keyword()) ::
  {:invalid_opts, String.t()} | {:ok, struct()}

Validate provided options and return a Chunkr.Opts struct