OffsetLimit

data class OffsetLimit(val offset: Int, val limit: Int, val backwards: Boolean = false)(source)

Result of converting viaduct.api.types.ConnectionArguments to an offset/limit pair.

This is the bridge between GraphQL pagination arguments (first, after, last, before) and the offset-based slice that a backend query requires. Produced by viaduct.api.types.ConnectionArguments.toOffsetLimit and consumed by viaduct.api.internal.ConnectionBuilder internally.

Constructors

Link copied to clipboard
constructor(offset: Int, limit: Int, backwards: Boolean = false)

Properties

Link copied to clipboard
val backwards: Boolean = false

If true, the requested window should be resolved from the end of the full dataset. Set when last is provided without a before cursor, meaning "give me the last N items." viaduct.api.internal.ConnectionBuilder.fromList uses this flag to slice from the tail; viaduct.api.internal.ConnectionBuilder.fromSlice ignores it (the caller is responsible for pre-computing the correct slice).

Link copied to clipboard
val limit: Int

Maximum number of items to fetch.

Link copied to clipboard
val offset: Int

Zero-based index of the first item to fetch.