toOffsetLimit

abstract fun toOffsetLimit(defaultPageSize: Int = 20): OffsetLimit(source)

Converts connection arguments to offset/limit for database queries.

Return

OffsetLimit containing the calculated offset and limit

Parameters

defaultPageSize

Default number of items when first/last not specified (default: 20)

Throws

for invalid argument combinations or values


open fun toOffsetLimit(totalCount: Int, defaultPageSize: Int = 20): OffsetLimit(source)

Converts connection arguments to offset/limit when the total count of items is known.

This overload is required when requiresTotalCountForOffsetLimit returns true (i.e., backward pagination with only last specified). In that case, the offset is computed as max(0, totalCount - last).

For forward pagination or backward pagination with a before cursor, the totalCount is ignored and this delegates to toOffsetLimit(Int).

Return

OffsetLimit containing the calculated offset and limit

Parameters

totalCount

Total number of items in the full dataset

defaultPageSize

Default number of items when first/last not specified (default: 20)

Throws

for invalid argument combinations or values