View Source Fob.PageBreak (Fob v1.0.5)
Functions and types for operating on page break values
Link to this section Summary
Functions
Compares two page breaks given the ordering defined in the queryable
Expands the n-dimensional space occupied by a bound of page-breaks
Link to this section Types
Link to this section Functions
@spec compare([t()], [t()], Ecto.Queryable.t()) :: :lt | :eq | :gt
Compares two page breaks given the ordering defined in the queryable
Returns :eq
if the two page breaks are equal, :lt
if a
is would come
before b
in the data set when queried, and :gt
if b
would come before
a
.
@spec expand_space(start :: [t()], stop :: [t()], proposed :: [t()], Ecto.Query.t()) :: {new_start :: [t()], new_stop :: [t()]}
Expands the n-dimensional space occupied by a bound of page-breaks
If one holds on to the page-breaks from the start
and stop
of a dataset
(with start
being the first record returned and stop
being the last
record of the most recently requested page; i.e. the cursor), they have
the boundaries of the page-break-space for the query
. It can be useful to
be able to expand this space in the case of row insertions into the database.
If an insertion comes in, one must compute its page-break values and compare
those to the held start
and stop
page-break values.
This function performs that comparison and returns a tuple of the new
start
and stop
, where proposed
could possibly replace the start
or
stop
(or neither).