OffsetCursor

A cursor for offset-based pagination.

OffsetCursor wraps an encoded cursor string that represents a position in a paginated list. The cursor format is: Base64("__viaduct:idx:<offset>").

Java equivalent of Kotlin's viaduct.api.types.OffsetCursor. The encode/decode logic lives in the language-neutral OffsetCursorCodec, shared with the Kotlin Tenant API, so cursors produced by either language are byte-for-byte interchangeable.

  • getValue holds the encoded cursor string (e.g. "X192aWFkdWN0OmlkeDow")
  • toOffsetdecodes the cursor string to get the offset
  • fromOffsetcreates an OffsetCursor by encoding the offset

Constructors

Link copied to clipboard
constructor(value: String)

Properties

Link copied to clipboard

Functions

Link copied to clipboard
open fun fromOffset(offset: Int): OffsetCursor
Creates an OffsetCursor from an offset value.
Link copied to clipboard
open fun isValid(cursor: String): Boolean
Checks if a cursor string is valid without throwing.
Link copied to clipboard
open fun toOffset(): Int
Decodes this cursor to get the offset value.