Scrivener (scrivener v2.7.2)

Scrivener is a pagination library for the Elixir ecosystem. You most likely won't use Scrivener directly, but rather a library that implements Scrivener's Paginater protocol for the object you're trying to paginate.

Link to this section Summary

Functions

Scrivener is meant to be used by a module.

Link to this section Functions

Link to this macro

__using__(opts)

(macro)

Scrivener is meant to be used by a module.

When used, an optional default for page_size can be provided. If page_size is not provided a default of 10 will be used.

A max_page_size can also optionally can be provided. This enforces a hard ceiling for the page size, even if you allow users of your application to specify page_size via query parameters. If not provided, there will be no limit to page size.

defmodule MyApp.Module do
  use Scrivener
end

defmodule MyApp.Module do
  use Scrivener, page_size: 5, max_page_size: 100
end

When use is called, a paginate function is defined in the module. See the Scrivener.Paginater protocol documentation for more information.