scrivener v2.0.0 Scrivener

Scrivener is a pagnation 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.

Summary

Macros

Scrivener is meant to be used by a module

Macros

__using__(opts)

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.