ysny.karibu-tools.karibu-tools.0.21.source-code.DataProviderUtils.kt Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of karibu-tools Show documentation
Show all versions of karibu-tools Show documentation
Karibu-Tools: The Vaadin Missing Utilities
The newest version!
package com.github.mvysny.kaributools
import com.vaadin.flow.data.provider.DataProvider
import com.vaadin.flow.data.provider.Query
import com.vaadin.flow.data.provider.QuerySortOrder
import com.vaadin.flow.data.provider.SortDirection
import kotlin.reflect.KProperty1
import kotlin.streams.toList
/**
* Returns all items provided by this data provider as an eager list. Careful with larger data!
*/
public fun DataProvider.fetchAll(): List = fetch(Query()).toList()
public val KProperty1.asc: QuerySortOrder get() = QuerySortOrder(name, SortDirection.ASCENDING)
public val KProperty1.desc: QuerySortOrder get() = QuerySortOrder(name, SortDirection.DESCENDING)