Reads numbers that arrive from outside — a URL parameter, a LiveView event, a peer's WebSocket payload, an API request — where anything can turn up.
Summary
Functions
Returns value as an integer within min..max.
The largest record offset accepted from a request or a peer.
Returns value as a page number from 1 to max.
Functions
Returns value as an integer within min..max.
A whole number (an integer, or a string holding only one, surrounding
spaces aside) is clamped to the bounds; anything else — text, a
fraction, "5abc", nil — gives default. Clamping also keeps a huge
page or offset from overflowing the database's bigint.
@spec max_offset() :: pos_integer()
The largest record offset accepted from a request or a peer.
@spec page(term(), pos_integer()) :: pos_integer()
Returns value as a page number from 1 to max.
Anything that is not a whole number in that range gives page 1, a page
above max included: a page that far out is a broken link, not a request
for the last page. The caller clamps a page past its own last page.