-
- All Implemented Interfaces:
-
io.quarkus.mongodb.panache.kotlin.reactive.ReactivePanacheQuery
public final class ReactivePanacheQueryImpl<Entity extends Object> implements ReactivePanacheQuery<Entity>
-
-
Method Summary
Modifier and Type Method Description <T extends Any> ReactivePanacheQuery<T>project(Class<T> type)Defines a projection class: the getters, and the public fields, will be used to restrict which fields should be retrieved from the database. ReactivePanacheQuery<Entity>page(Page page)Sets the current page. ReactivePanacheQuery<Entity>page(Integer pageIndex, Integer pageSize)Sets the current page. Pagepage()Returns the current page. ReactivePanacheQuery<Entity>nextPage()Sets the current page to the next page ReactivePanacheQuery<Entity>previousPage()Sets the current page to the previous page (or the first page if there is no previous page) ReactivePanacheQuery<Entity>firstPage()Sets the current page to the first page Uni<ReactivePanacheQuery<Entity>>lastPage()Sets the current page to the last page. Uni<Boolean>hasNextPage()Returns true if there is another page to read after the current one. BooleanhasPreviousPage()Returns true if there is a page to read before the current one. Uni<Integer>pageCount()Returns the total number of pages to be read using the current page size. ReactivePanacheQuery<Entity>range(Integer startIndex, Integer lastIndex)Switch the query to use a fixed range (start index - last index) instead of a page. ReactivePanacheQuery<Entity>withCollation(Collation collation)Define the collation used for this query. ReactivePanacheQuery<Entity>withReadPreference(ReadPreference readPreference)Define the read preference used for this query. Uni<Long>count()Reads and caches the total number of entities this query operates on. Uni<List<Entity>>list()Returns the current page of results as a List. Multi<Entity>stream()Returns the current page of results as a Stream. Uni<Entity>firstResult()Returns the first result of the current page index. Uni<Entity>singleResult()Executes this query for the current page and return a single result. -
-
Method Detail
-
project
<T extends Any> ReactivePanacheQuery<T> project(Class<T> type)
Defines a projection class: the getters, and the public fields, will be used to restrict which fields should be retrieved from the database.
-
page
ReactivePanacheQuery<Entity> page(Page page)
Sets the current page.
- Parameters:
page- the new page
-
page
ReactivePanacheQuery<Entity> page(Integer pageIndex, Integer pageSize)
Sets the current page.
- Parameters:
pageIndex- the page indexpageSize- the page size
-
page
Page page()
Returns the current page.
-
nextPage
ReactivePanacheQuery<Entity> nextPage()
Sets the current page to the next page
-
previousPage
ReactivePanacheQuery<Entity> previousPage()
Sets the current page to the previous page (or the first page if there is no previous page)
-
firstPage
ReactivePanacheQuery<Entity> firstPage()
Sets the current page to the first page
-
lastPage
Uni<ReactivePanacheQuery<Entity>> lastPage()
Sets the current page to the last page. This will cause reading of the entity count.
-
hasNextPage
Uni<Boolean> hasNextPage()
Returns true if there is another page to read after the current one. This will cause reading of the entity count.
-
hasPreviousPage
Boolean hasPreviousPage()
Returns true if there is a page to read before the current one.
-
pageCount
Uni<Integer> pageCount()
Returns the total number of pages to be read using the current page size. This will cause reading of the entity count.
-
range
ReactivePanacheQuery<Entity> range(Integer startIndex, Integer lastIndex)
Switch the query to use a fixed range (start index - last index) instead of a page. As the range is fixed, subsequent pagination of the query is not possible.
- Parameters:
startIndex- the index of the first element, starting at 0lastIndex- the index of the last element
-
withCollation
ReactivePanacheQuery<Entity> withCollation(Collation collation)
Define the collation used for this query.
- Parameters:
collation- the collation to be used for this query.
-
withReadPreference
ReactivePanacheQuery<Entity> withReadPreference(ReadPreference readPreference)
Define the read preference used for this query.
- Parameters:
readPreference- the read preference to be used for this query.
-
count
Uni<Long> count()
Reads and caches the total number of entities this query operates on. This causes a database query with
SELECT COUNT(*)and a query equivalent to the current query, minus ordering.
-
firstResult
Uni<Entity> firstResult()
Returns the first result of the current page index. This ignores the current page size to fetch a single result.
-
singleResult
Uni<Entity> singleResult()
Executes this query for the current page and return a single result.
-
-
-
-