Aurora.Ctx.Pagination (Aurora.Ctx v0.1.2)

View Source

Struct for handling pagination state.

Configuration

Default pagination settings can be configured in your config.exs:

config :aurora_ctx, :pagination,
  page: 1,
  per_page: 40

If not configured, defaults to page: 1, per_page: 40.

Summary

Functions

Creates a new pagination struct with safe defaults.

Creates a new pagination struct with safe defaults.

Types

t()

@type t() :: %Aurora.Ctx.Pagination{
  entries: list(),
  entries_count: non_neg_integer() | nil,
  opts: keyword(),
  page: pos_integer(),
  pages_count: pos_integer() | nil,
  per_page: pos_integer(),
  repo_module: module() | nil,
  schema_module: module() | nil
}

Functions

new()

@spec new() :: t()

Creates a new pagination struct with safe defaults.

Returns: t()

new(attrs)

@spec new(map() | keyword()) :: t()

Creates a new pagination struct with safe defaults.

Parameters:

  • attrs (map | keyword): Pagination attributes

    • :page (pos_integer): Page number (default: 1)
    • :per_page (pos_integer): Items per page (default: 40)

Returns: t()