Class ReactivePanacheQueryImpl<Entity>
- java.lang.Object
-
- io.quarkus.mongodb.panache.reactive.runtime.ReactivePanacheQueryImpl<Entity>
-
- All Implemented Interfaces:
ReactivePanacheQuery<Entity>
public class ReactivePanacheQueryImpl<Entity> extends Object implements ReactivePanacheQuery<Entity>
-
-
Constructor Summary
Constructors Constructor Description ReactivePanacheQueryImpl(io.quarkus.mongodb.reactive.ReactiveMongoCollection<? extends Entity> collection, org.bson.conversions.Bson mongoQuery, org.bson.conversions.Bson sort)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description io.smallrye.mutiny.Uni<Long>count()Reads and caches the total number of entities this query operates on.<T extends Entity>
ReactivePanacheQuery<T>firstPage()Sets the current page to the first page<T extends Entity>
io.smallrye.mutiny.Uni<T>firstResult()Returns the first result of the current page index.<T extends Entity>
io.smallrye.mutiny.Uni<Optional<T>>firstResultOptional()Returns the first result of the current page index.io.smallrye.mutiny.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.<T extends Entity>
io.smallrye.mutiny.Uni<ReactivePanacheQuery<T>>lastPage()Sets the current page to the last page.<T extends Entity>
io.smallrye.mutiny.Uni<List<T>>list()Returns the current page of results as aList.<T extends Entity>
ReactivePanacheQuery<T>nextPage()Sets the current page to the next pagePagepage()Returns the current page.<T extends Entity>
ReactivePanacheQuery<T>page(int pageIndex, int pageSize)Sets the current page.<T extends Entity>
ReactivePanacheQuery<T>page(Page page)Sets the current page.io.smallrye.mutiny.Uni<Integer>pageCount()Returns the total number of pages to be read using the current page size.<T extends Entity>
ReactivePanacheQuery<T>previousPage()Sets the current page to the previous page (or the first page if there is no previous page)<T> 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.<T extends Entity>
ReactivePanacheQuery<T>range(int startIndex, int lastIndex)Switch the query to use a fixed range (start index - last index) instead of a page.<T extends Entity>
io.smallrye.mutiny.Uni<T>singleResult()Executes this query for the current page and return a single result.<T extends Entity>
io.smallrye.mutiny.Uni<Optional<T>>singleResultOptional()Executes this query for the current page and return a single result.<T extends Entity>
io.smallrye.mutiny.Multi<T>stream()Returns the current page of results as aStream.<T extends Entity>
ReactivePanacheQuery<T>withCollation(com.mongodb.client.model.Collation collation)Define the collation used for this query.<T extends Entity>
ReactivePanacheQuery<T>withReadPreference(com.mongodb.ReadPreference readPreference)Define the read preference used for this query.
-
-
-
Constructor Detail
-
ReactivePanacheQueryImpl
ReactivePanacheQueryImpl(io.quarkus.mongodb.reactive.ReactiveMongoCollection<? extends Entity> collection, org.bson.conversions.Bson mongoQuery, org.bson.conversions.Bson sort)
-
-
Method Detail
-
project
public <T> ReactivePanacheQuery<T> project(Class<T> type)
Description copied from interface:ReactivePanacheQueryDefines a projection class: the getters, and the public fields, will be used to restrict which fields should be retrieved from the database.- Specified by:
projectin interfaceReactivePanacheQuery<Entity>- Returns:
-
page
public <T extends Entity> ReactivePanacheQuery<T> page(Page page)
Description copied from interface:ReactivePanacheQuerySets the current page.- Specified by:
pagein interfaceReactivePanacheQuery<Entity>- Parameters:
page- the new page- Returns:
- this query, modified
- See Also:
ReactivePanacheQuery.page(int, int),ReactivePanacheQuery.page()
-
page
public <T extends Entity> ReactivePanacheQuery<T> page(int pageIndex, int pageSize)
Description copied from interface:ReactivePanacheQuerySets the current page.- Specified by:
pagein interfaceReactivePanacheQuery<Entity>- Parameters:
pageIndex- the page index (0-based)pageSize- the page size- Returns:
- this query, modified
- See Also:
ReactivePanacheQuery.page(Page),ReactivePanacheQuery.page()
-
nextPage
public <T extends Entity> ReactivePanacheQuery<T> nextPage()
Description copied from interface:ReactivePanacheQuerySets the current page to the next page- Specified by:
nextPagein interfaceReactivePanacheQuery<Entity>- Returns:
- this query, modified
- See Also:
ReactivePanacheQuery.previousPage()
-
previousPage
public <T extends Entity> ReactivePanacheQuery<T> previousPage()
Description copied from interface:ReactivePanacheQuerySets the current page to the previous page (or the first page if there is no previous page)- Specified by:
previousPagein interfaceReactivePanacheQuery<Entity>- Returns:
- this query, modified
- See Also:
ReactivePanacheQuery.nextPage()
-
firstPage
public <T extends Entity> ReactivePanacheQuery<T> firstPage()
Description copied from interface:ReactivePanacheQuerySets the current page to the first page- Specified by:
firstPagein interfaceReactivePanacheQuery<Entity>- Returns:
- this query, modified
- See Also:
ReactivePanacheQuery.lastPage()
-
lastPage
public <T extends Entity> io.smallrye.mutiny.Uni<ReactivePanacheQuery<T>> lastPage()
Description copied from interface:ReactivePanacheQuerySets the current page to the last page. This will cause reading of the entity count.- Specified by:
lastPagein interfaceReactivePanacheQuery<Entity>- Returns:
- this query, modified
- See Also:
ReactivePanacheQuery.firstPage(),ReactivePanacheQuery.count()
-
hasNextPage
public io.smallrye.mutiny.Uni<Boolean> hasNextPage()
Description copied from interface:ReactivePanacheQueryReturns true if there is another page to read after the current one. This will cause reading of the entity count.- Specified by:
hasNextPagein interfaceReactivePanacheQuery<Entity>- Returns:
- true if there is another page to read
- See Also:
ReactivePanacheQuery.hasPreviousPage(),ReactivePanacheQuery.count()
-
hasPreviousPage
public boolean hasPreviousPage()
Description copied from interface:ReactivePanacheQueryReturns true if there is a page to read before the current one.- Specified by:
hasPreviousPagein interfaceReactivePanacheQuery<Entity>- Returns:
- true if there is a previous page to read
- See Also:
ReactivePanacheQuery.hasNextPage()
-
pageCount
public io.smallrye.mutiny.Uni<Integer> pageCount()
Description copied from interface:ReactivePanacheQueryReturns the total number of pages to be read using the current page size. This will cause reading of the entity count.- Specified by:
pageCountin interfaceReactivePanacheQuery<Entity>- Returns:
- the total number of pages to be read using the current page size.
-
page
public Page page()
Description copied from interface:ReactivePanacheQueryReturns the current page.- Specified by:
pagein interfaceReactivePanacheQuery<Entity>- Returns:
- the current page
- See Also:
ReactivePanacheQuery.page(Page),ReactivePanacheQuery.page(int,int)
-
range
public <T extends Entity> ReactivePanacheQuery<T> range(int startIndex, int lastIndex)
Description copied from interface:ReactivePanacheQuerySwitch 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.- Specified by:
rangein interfaceReactivePanacheQuery<Entity>- Parameters:
startIndex- the index of the first element, starting at 0lastIndex- the index of the last element- Returns:
- this query, modified
-
withCollation
public <T extends Entity> ReactivePanacheQuery<T> withCollation(com.mongodb.client.model.Collation collation)
Description copied from interface:ReactivePanacheQueryDefine the collation used for this query.- Specified by:
withCollationin interfaceReactivePanacheQuery<Entity>- Parameters:
collation- the collation to be used for this query.- Returns:
- this query, modified
-
withReadPreference
public <T extends Entity> ReactivePanacheQuery<T> withReadPreference(com.mongodb.ReadPreference readPreference)
Description copied from interface:ReactivePanacheQueryDefine the read preference used for this query.- Specified by:
withReadPreferencein interfaceReactivePanacheQuery<Entity>- Parameters:
readPreference- the read preference to be used for this query.- Returns:
- this query, modified
-
count
public io.smallrye.mutiny.Uni<Long> count()
Description copied from interface:ReactivePanacheQueryReads and caches the total number of entities this query operates on. This causes a database query withSELECT COUNT(*)and a query equivalent to the current query, minus ordering.- Specified by:
countin interfaceReactivePanacheQuery<Entity>- Returns:
- the total number of entities this query operates on, cached.
-
list
public <T extends Entity> io.smallrye.mutiny.Uni<List<T>> list()
Description copied from interface:ReactivePanacheQueryReturns the current page of results as aList.- Specified by:
listin interfaceReactivePanacheQuery<Entity>- Returns:
- the current page of results as a
List. - See Also:
ReactivePanacheQuery.page(Page),ReactivePanacheQuery.page()
-
stream
public <T extends Entity> io.smallrye.mutiny.Multi<T> stream()
Description copied from interface:ReactivePanacheQueryReturns the current page of results as aStream.- Specified by:
streamin interfaceReactivePanacheQuery<Entity>- Returns:
- the current page of results as a
Stream. - See Also:
ReactivePanacheQuery.list(),ReactivePanacheQuery.page(Page),ReactivePanacheQuery.page()
-
firstResult
public <T extends Entity> io.smallrye.mutiny.Uni<T> firstResult()
Description copied from interface:ReactivePanacheQueryReturns the first result of the current page index. This ignores the current page size to fetch a single result.- Specified by:
firstResultin interfaceReactivePanacheQuery<Entity>- Returns:
- the first result of the current page index, or null if there are no results.
- See Also:
ReactivePanacheQuery.singleResult()
-
firstResultOptional
public <T extends Entity> io.smallrye.mutiny.Uni<Optional<T>> firstResultOptional()
Description copied from interface:ReactivePanacheQueryReturns the first result of the current page index. This ignores the current page size to fetch a single result.- Specified by:
firstResultOptionalin interfaceReactivePanacheQuery<Entity>- Returns:
- if found, an optional containing the entity, else
Optional.empty(). - See Also:
ReactivePanacheQuery.singleResultOptional()
-
singleResult
public <T extends Entity> io.smallrye.mutiny.Uni<T> singleResult()
Description copied from interface:ReactivePanacheQueryExecutes this query for the current page and return a single result.- Specified by:
singleResultin interfaceReactivePanacheQuery<Entity>- Returns:
- the single result.
- See Also:
ReactivePanacheQuery.firstResult()
-
singleResultOptional
public <T extends Entity> io.smallrye.mutiny.Uni<Optional<T>> singleResultOptional()
Description copied from interface:ReactivePanacheQueryExecutes this query for the current page and return a single result.- Specified by:
singleResultOptionalin interfaceReactivePanacheQuery<Entity>- Returns:
- if found, an optional containing the entity, else
Optional.empty(). - See Also:
ReactivePanacheQuery.firstResultOptional()
-
-