Class DittoQueryResult
- All Implemented Interfaces:
AutoCloseable
Represents the results returned when executing a DQL (Ditto Query Language) query.
Each query result contains a list of DittoQueryResultItem instances, one for each
document matching the query. For mutating queries, the result also includes the IDs of
documents that were modified locally.
This class implements AutoCloseable to manage resources. Always close the result
when done, preferably using try-with-resources statements.
- See Also:
- API Note:
- More info such as metrics, affected document IDs, etc. will be provided in the near future.
-
Method Summary
Modifier and TypeMethodDescriptionvoidclose()Closes this query result and releases associated resources.@NonNull List<? extends DittoQueryResultItem> getItems()Returns the individual items matching the DQL query.@NonNull Set<? extends DittoCborSerializable> Returns the IDs of documents that were mutated locally by a mutating DQL query.booleanisClosed()
-
Method Details
-
getItems
Returns the individual items matching the DQL query.
Each item represents a document that matched the query criteria.
- Returns:
- a list of
DittoQueryResultIteminstances, one for each matching document.
-
getMutatedDocumentIds
Returns the IDs of documents that were mutated locally by a mutating DQL query.
This method returns the IDs of documents that were modified locally when executing mutating DQL queries (INSERT, UPDATE, DELETE, etc.). The set will be empty if no documents were mutated.
Note: A
DittoStoreObservercan only be registered with a SELECT query, which is non-mutating. Therefore, query results passed to aDittoStoreObserverwill always return an empty set.Important: The returned document IDs are not cached. Call this method once and keep the return value for as long as needed to avoid unnecessary recomputation.
- Returns:
- a set of
DittoCborSerializabledocument IDs that were mutated locally.
-
close
Closes this query result and releases associated resources.
This method should be called when the query result is no longer needed to free resources. Use try-with-resources statements for automatic cleanup.
- Specified by:
closein interfaceAutoCloseable- Throws:
DittoException- if an error occurs during cleanup.
-
isClosed
public boolean isClosed()
-