val sortConfig = Query.where{ has(TestComponent.id) }
.with {
by(TestComponent.intVarData)
by(TestComponent.stringVarData).descCaseInsensitive()
}.take(0, 10)
class SortBuilder
SortBuilder
()
:
SortBuilder |
Signature
constructor() Returns |
take
(
offset
,
count
)
:
SortBuilder |
Defines the range of sorting results by specifying the starting index and the number of items to include.
Signature
fun take(offset: Int, count: Int): SortBuilder Parameters
offset:
Int
count:
Int
Returns
The current instance of SortBuilder, allowing for method chaining.
Example:
// Get the first 10 items (items 0-9)
{
with { by(TestComponent.intVarData) }
take(0, 10)
}
// Get the next 10 items (items 10-19)
{
with { by(TestComponent.intVarData) }
take(10, 10)
}
|
with
(
init
)
:
SortBuilder |
Configures the sorting criteria using a lambda function.
Signature
fun with(init: SortCriteriaBuilder.() -> Unit): SortBuilder Parameters
init:
Function1
this within the lambda, allowing you to call its methods directly.
Returns
The current instance of SortBuilder for method chaining.
Example -- Sort by the intVar attribute of the TestComponent; if there's a tie, sort by the stringVar attribute, ignoring case; if there's still a tie, sort by the Z component of the vector3Var attribute:
with {
by(TestComponent.intVarData)
by(TestComponent.stringVarData).descCaseInsensitive()
by(TestComponent.vector3VarData).byZ()
}
|