to Offset Limit
Converts backward pagination arguments to offset/limit.
last determines the page size (defaults to defaultPageSize).
before cursor encodes the index of the first item on the next page; the offset and limit are computed to return the last items ending just before that position. Both are clamped so the window never extends before index 0.
If before is absent, a negative offset equal to
-pageSizeis returned, signalling viaduct.api.internal.ConnectionBuilder.fromList to resolve from the tail of the full list. Prefer using toOffsetLimit(Int, Int) with the total count when available.
Converts backward pagination arguments to offset/limit when the total count is known.
When before is absent, this computes the offset as max(0, totalCount - last) to return the last N items from the dataset, avoiding the negative-offset signal used by toOffsetLimit(Int).
When before is present, totalCount is ignored and this delegates to toOffsetLimit(Int).
Parameters
Total number of items in the full dataset
Default number of items when last not specified (default: 20)