Package dev.inmo.micro_utils.pagination

Types

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

Base interface of pagination

interface Pagination : ClosedRange<Int>

Base interface of pagination

interface Pagination : ClosedRange<Int>

Base interface of pagination

PaginationResult
Link copied to clipboard
data class PaginationResult<T>(    val page: Int,     val pagesNumber: Int,     val results: List<T>,     val size: Int) : Pagination
data class PaginationResult<T>(    val page: Int,     val pagesNumber: Int,     val results: List<T>,     val size: Int) : Pagination
data class PaginationResult<T>(    val page: Int,     val pagesNumber: Int,     val results: List<T>,     val size: Int) : Pagination
SimplePagination
Link copied to clipboard
data class SimplePagination(val page: Int, val size: Int) : Pagination
data class SimplePagination(val page: Int, val size: Int) : Pagination
data class SimplePagination(val page: Int, val 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

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

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

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

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

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?
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

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

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

val Pagination.firstIndex: Int

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

val Pagination.firstIndex: Int

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

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

Logical shortcut for comparison that page is 0

val Pagination.isFirstPage: Boolean

Logical shortcut for comparison that page is 0

val Pagination.isFirstPage: Boolean

Logical shortcut for comparison that page is 0

Link copied to clipboard
val Pagination.lastIndex: Int

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

val Pagination.lastIndex: Int

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

val Pagination.lastIndex: Int

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

Link copied to clipboard
val Pagination.lastIndexExclusive: Int

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

val Pagination.lastIndexExclusive: Int

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

val Pagination.lastIndexExclusive: Int

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

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