Package dev.inmo.micro_utils.pagination

Types

Pagination
Link copied to clipboard
interface Pagination : ClosedRange<Int>
interface Pagination : ClosedRange<Int>
interface Pagination : ClosedRange<Int>

Base interface of pagination

PaginationResult
Link copied to clipboard
data class PaginationResult<T>(page: Int, pagesNumber: Int, results: List<T>, size: Int) : Pagination
data class PaginationResult<T>(page: Int, pagesNumber: Int, results: List<T>, size: Int) : Pagination
data class PaginationResult<T>(page: Int, pagesNumber: Int, results: List<T>, size: Int) : Pagination
SimplePagination
Link copied to clipboard
data class SimplePagination(page: Int, size: Int) : Pagination
data class SimplePagination(page: Int, size: Int) : Pagination
data class SimplePagination(page: Int, size: Int) : Pagination

Functions

calculatePage
Link copied to clipboard
fun calculatePage(firstIndex: Int, resultsSize: Int): Int
fun calculatePage(firstIndex: Int, resultsSize: Int): Int
fun calculatePage(firstIndex: Int, resultsSize: Int): Int
calculatePagesNumber
Link copied to clipboard
fun calculatePagesNumber(datasetSize: Int, pageSize: Int): Int
fun calculatePagesNumber(datasetSize: Long, pageSize: Int): Int

Calculates pages count for given datasetSize

common
fun calculatePagesNumber(datasetSize: Int, pageSize: Int): Int
fun calculatePagesNumber(datasetSize: Long, pageSize: Int): Int

Calculates pages count for given datasetSize

fun calculatePagesNumber(datasetSize: Int, pageSize: Int): Int
fun calculatePagesNumber(datasetSize: Long, pageSize: Int): Int

Calculates pages count for given datasetSize

fun calculatePagesNumber(pageSize: Int, datasetSize: Long): Int

Calculates pages count for given datasetSize. As a fact, it is shortcut for calculatePagesNumber

common
fun calculatePagesNumber(pageSize: Int, datasetSize: Long): Int

Calculates pages count for given datasetSize. As a fact, it is shortcut for calculatePagesNumber

fun calculatePagesNumber(pageSize: Int, datasetSize: Long): Int

Calculates pages count for given datasetSize. As a fact, it is shortcut for calculatePagesNumber

changeResults
Link copied to clipboard
fun <I, O> PaginationResult<I>.changeResults(data: List<O>): PaginationResult<O>
fun <I, O> PaginationResult<I>.changeResults(data: List<O>): PaginationResult<O>
fun <I, O> PaginationResult<I>.changeResults(data: List<O>): PaginationResult<O>
changeResultsUnchecked
Link copied to clipboard
fun <I, O> PaginationResult<I>.changeResultsUnchecked(data: List<O>): PaginationResult<O>
fun <I, O> PaginationResult<I>.changeResultsUnchecked(data: List<O>): PaginationResult<O>
fun <I, O> PaginationResult<I>.changeResultsUnchecked(data: List<O>): PaginationResult<O>
createPaginationResult
Link copied to clipboard
fun <T> Pair<Long, List<T>>.createPaginationResult(pagination: Pagination): PaginationResult<T>
fun <T> List<T>.createPaginationResult(pagination: Pagination, commonObjectsNumber: Long): PaginationResult<T>
fun <T> List<T>.createPaginationResult(firstIndex: Int, commonObjectsNumber: Long): PaginationResult<T>
fun <T> Pair<Long, List<T>>.createPaginationResult(pagination: Pagination): PaginationResult<T>
fun <T> List<T>.createPaginationResult(pagination: Pagination, commonObjectsNumber: Long): PaginationResult<T>
fun <T> List<T>.createPaginationResult(firstIndex: Int, commonObjectsNumber: Long): PaginationResult<T>
fun <T> Pair<Long, List<T>>.createPaginationResult(pagination: Pagination): PaginationResult<T>
fun <T> List<T>.createPaginationResult(pagination: Pagination, commonObjectsNumber: Long): PaginationResult<T>
fun <T> List<T>.createPaginationResult(firstIndex: Int, commonObjectsNumber: Long): PaginationResult<T>
currentPageIfNotEmpty
Link copied to clipboard
inline fun <T> PaginationResult<T>.currentPageIfNotEmpty(): PaginationResult<T>?
inline fun <T> PaginationResult<T>.currentPageIfNotEmpty(): PaginationResult<T>?
inline fun <T> PaginationResult<T>.currentPageIfNotEmpty(): PaginationResult<T>?
doWithPagination
Link copied to clipboard
inline fun doWithPagination(startPagination: Pagination = FirstPagePagination(), requestMaker: (pagination: Pagination) -> Pagination?)
inline fun doWithPagination(startPagination: Pagination = FirstPagePagination(), requestMaker: (pagination: Pagination) -> Pagination?)
inline fun doWithPagination(startPagination: Pagination = FirstPagePagination(), requestMaker: (pagination: Pagination) -> Pagination?)
emptyPaginationResult
Link copied to clipboard
fun <T> emptyPaginationResult(): PaginationResult<T>
fun <T> emptyPaginationResult(): PaginationResult<T>
fun <T> emptyPaginationResult(): PaginationResult<T>
FirstPagePagination
Link copied to clipboard
inline fun FirstPagePagination(size: Int = defaultPaginationPageSize): SimplePagination
inline fun FirstPagePagination(size: Int = defaultPaginationPageSize): SimplePagination
inline fun FirstPagePagination(size: Int = defaultPaginationPageSize): SimplePagination
intersect
Link copied to clipboard
fun Pagination.intersect(other: Pagination): Pagination?
fun Pagination.intersect(other: Pagination): Pagination?
fun Pagination.intersect(other: Pagination): Pagination?
nextPage
Link copied to clipboard
inline fun Pagination.nextPage(): SimplePagination
inline fun Pagination.nextPage(): SimplePagination
inline fun Pagination.nextPage(): SimplePagination
nextPageIfNotEmpty
Link copied to clipboard
inline fun PaginationResult<*>.nextPageIfNotEmpty(): SimplePagination?
inline fun PaginationResult<*>.nextPageIfNotEmpty(): SimplePagination?
inline fun PaginationResult<*>.nextPageIfNotEmpty(): SimplePagination?
paginate
Link copied to clipboard
fun <ERROR CLASS>.paginate(with: Pagination, orderBy: Pair<<ERROR CLASS><out <ERROR CLASS>>, <ERROR CLASS>>? = null): <ERROR CLASS>
fun <ERROR CLASS>.paginate(with: Pagination, orderBy: <ERROR CLASS><out <ERROR CLASS>>?, reversed: Boolean = false): <ERROR CLASS>
Pagination
Link copied to clipboard
fun Pagination(page: Int, size: Int): SimplePagination

Factory for SimplePagination

common
fun Pagination(page: Int, size: Int): SimplePagination

Factory for SimplePagination

fun Pagination(page: Int, size: Int): SimplePagination

Factory for SimplePagination

PaginationByIndexes
Link copied to clipboard
fun PaginationByIndexes(firstIndex: Int, lastIndex: Int): SimplePagination
fun PaginationByIndexes(firstIndex: Int, lastIndex: Int): SimplePagination
fun PaginationByIndexes(firstIndex: Int, lastIndex: Int): SimplePagination
thisPageIfNotEmpty
Link copied to clipboard
inline fun <T> PaginationResult<T>.thisPageIfNotEmpty(): PaginationResult<T>?
inline fun <T> PaginationResult<T>.thisPageIfNotEmpty(): PaginationResult<T>?
inline fun <T> PaginationResult<T>.thisPageIfNotEmpty(): PaginationResult<T>?

Properties

asUrlQueryArrayParts
Link copied to clipboard
val Pagination.asUrlQueryArrayParts: Array<Pair<String, String>>
asUrlQueryArrayParts
Link copied to clipboard
common
val Pagination.asUrlQueryArrayParts: Array<Pair<String, String>>
asUrlQueryArrayParts
Link copied to clipboard
val Pagination.asUrlQueryArrayParts: Array<Pair<String, String>>
asUrlQueryParts
Link copied to clipboard
val Pagination.asUrlQueryParts: Map<String, String>
asUrlQueryParts
Link copied to clipboard
common
val Pagination.asUrlQueryParts: Map<String, String>
asUrlQueryParts
Link copied to clipboard
val Pagination.asUrlQueryParts: Map<String, String>
defaultExtraLargePageSize
Link copied to clipboard
const val defaultExtraLargePageSize: Int = 15
defaultExtraLargePageSize
Link copied to clipboard
common
const val defaultExtraLargePageSize: Int = 15
defaultExtraLargePageSize
Link copied to clipboard
const val defaultExtraLargePageSize: Int = 15
defaultLargePageSize
Link copied to clipboard
const val defaultLargePageSize: Int = 10
defaultLargePageSize
Link copied to clipboard
common
const val defaultLargePageSize: Int = 10
defaultLargePageSize
Link copied to clipboard
const val defaultLargePageSize: Int = 10
defaultMediumPageSize
Link copied to clipboard
const val defaultMediumPageSize: Int = 5
defaultMediumPageSize
Link copied to clipboard
common
const val defaultMediumPageSize: Int = 5
defaultMediumPageSize
Link copied to clipboard
const val defaultMediumPageSize: Int = 5
defaultPaginationPageSize
Link copied to clipboard
var defaultPaginationPageSize: Int
defaultPaginationPageSize
Link copied to clipboard
common
var defaultPaginationPageSize: Int
defaultPaginationPageSize
Link copied to clipboard
var defaultPaginationPageSize: Int
defaultSmallPageSize
Link copied to clipboard
const val defaultSmallPageSize: Int = 2
defaultSmallPageSize
Link copied to clipboard
common
const val defaultSmallPageSize: Int = 2
defaultSmallPageSize
Link copied to clipboard
const val defaultSmallPageSize: Int = 2
emptyPagination
Link copied to clipboard
val emptyPagination: SimplePagination
emptyPagination
Link copied to clipboard
common
val emptyPagination: SimplePagination
emptyPagination
Link copied to clipboard
val emptyPagination: SimplePagination
extractPagination
Link copied to clipboard
val Map<String, String?>.extractPagination: Pagination
extractPagination
Link copied to clipboard
common
val Map<String, String?>.extractPagination: Pagination
extractPagination
Link copied to clipboard
val Map<String, String?>.extractPagination: Pagination
extractPagination
Link copied to clipboard
val <ERROR CLASS>.extractPagination: Pagination
extractPagination
Link copied to clipboard
val <ERROR CLASS>.extractPagination: Pagination
firstIndex
Link copied to clipboard
val Pagination.firstIndex: Int

First number in index of objects. It can be used as offset for databases or other data sources

firstIndex
Link copied to clipboard
common
val Pagination.firstIndex: Int

First number in index of objects. It can be used as offset for databases or other data sources

firstIndex
Link copied to clipboard
val Pagination.firstIndex: Int

First number in index of objects. It can be used as offset for databases or other data sources

firstPageWithOneElementPagination
Link copied to clipboard
val firstPageWithOneElementPagination: SimplePagination
firstPageWithOneElementPagination
Link copied to clipboard
common
val firstPageWithOneElementPagination: SimplePagination
firstPageWithOneElementPagination
Link copied to clipboard
val firstPageWithOneElementPagination: SimplePagination
isFirstPage
Link copied to clipboard
val Pagination.isFirstPage: Boolean

Logical shortcut for comparison that page is 0

isFirstPage
Link copied to clipboard
common
val Pagination.isFirstPage: Boolean

Logical shortcut for comparison that page is 0

isFirstPage
Link copied to clipboard
val Pagination.isFirstPage: Boolean

Logical shortcut for comparison that page is 0

lastIndex
Link copied to clipboard
val Pagination.lastIndex: Int

Last number in index of objects. In fact, one Pagination object represent data in next range:

lastIndex
Link copied to clipboard
common
val Pagination.lastIndex: Int

Last number in index of objects. In fact, one Pagination object represent data in next range:

lastIndex
Link copied to clipboard
val Pagination.lastIndex: Int

Last number in index of objects. In fact, one Pagination object represent data in next range:

lastIndexExclusive
Link copied to clipboard
val Pagination.lastIndexExclusive: Int

Last number in index of objects. In fact, one Pagination object represent data in next range:

lastIndexExclusive
Link copied to clipboard
common
val Pagination.lastIndexExclusive: Int

Last number in index of objects. In fact, one Pagination object represent data in next range:

lastIndexExclusive
Link copied to clipboard
val Pagination.lastIndexExclusive: Int

Last number in index of objects. In fact, one Pagination object represent data in next range:

paginationPageKey
Link copied to clipboard
const val paginationPageKey: String
paginationPageKey
Link copied to clipboard
common
const val paginationPageKey: String
paginationPageKey
Link copied to clipboard
const val paginationPageKey: String
paginationSizeKey
Link copied to clipboard
const val paginationSizeKey: String
paginationSizeKey
Link copied to clipboard
common
const val paginationSizeKey: String
paginationSizeKey
Link copied to clipboard
const val paginationSizeKey: String