generate docs for a lot of API (test try)

This commit is contained in:
2026-02-24 18:18:10 +06:00
parent 3df90b1993
commit 4f270d9047
81 changed files with 2519 additions and 6 deletions

View File

@@ -4,6 +4,14 @@ import org.jetbrains.exposed.v1.core.Expression
import org.jetbrains.exposed.v1.core.SortOrder
import org.jetbrains.exposed.v1.jdbc.Query
/**
* Applies pagination to this Exposed [Query].
* Sets the limit and offset based on the pagination parameters, and optionally orders the results.
*
* @param with The pagination parameters to apply
* @param orderBy Optional pair of expression and sort order to order the results by
* @return The query with pagination and optional ordering applied
*/
fun Query.paginate(with: Pagination, orderBy: Pair<Expression<*>, SortOrder>? = null) =
limit(with.size)
.offset(with.firstIndex.toLong())
@@ -18,6 +26,15 @@ fun Query.paginate(with: Pagination, orderBy: Pair<Expression<*>, SortOrder>? =
}
}
/**
* Applies pagination to this Exposed [Query] with optional ordering and reversal.
* Sets the limit and offset based on the pagination parameters.
*
* @param with The pagination parameters to apply
* @param orderBy Optional expression to order the results by
* @param reversed If true, orders in descending order; otherwise ascending. Defaults to false
* @return The query with pagination and optional ordering applied
*/
fun Query.paginate(with: Pagination, orderBy: Expression<*>?, reversed: Boolean = false) = paginate(
with,
orderBy ?.let { it to if (reversed) SortOrder.DESC else SortOrder.ASC }