Package com.couchbase.client.java.query
Class QueryAccessor
java.lang.Object
com.couchbase.client.java.query.QueryAccessor
@Internal public class QueryAccessor extends Object
Converts requests and responses for N1QL queries.
Note that this accessor also transparently deals with prepared statements and the associated query cache.
Also, this class has internal functionality and is not intended to be called from the user directly.
-
Constructor Summary
Constructors Constructor Description QueryAccessor(Core core)
-
Method Summary
Modifier and Type Method Description CompletableFuture<QueryResult>
queryAsync(QueryRequest request, QueryOptions.Built options, JsonSerializer serializer)
Performs a N1QL query and returns the result as a future.Mono<ReactiveQueryResult>
queryReactive(QueryRequest request, QueryOptions.Built options, JsonSerializer serializer)
Performs a N1QL query and returns the result as a future.static QueryRequest
targetedQueryRequest(String statement, byte[] queryBytes, String clientContextId, NodeIdentifier target, boolean readonly, RetryStrategy retryStrategy, Duration timeout, RequestSpan parentSpan, Core core)
Used by the transactions library, this provides some binary interface protection against QueryRequest/TargetedQueryRequest changing.
-
Constructor Details
-
QueryAccessor
-
-
Method Details
-
queryAsync
public CompletableFuture<QueryResult> queryAsync(QueryRequest request, QueryOptions.Built options, JsonSerializer serializer)Performs a N1QL query and returns the result as a future.Note that compared to the reactive method, this one collects the rows into a list and makes sure everything is part of the result. If you need backpressure, go with reactive.
- Parameters:
request
- the request to perform.options
- query options to use.- Returns:
- the future once the result is complete.
-
queryReactive
public Mono<ReactiveQueryResult> queryReactive(QueryRequest request, QueryOptions.Built options, JsonSerializer serializer)Performs a N1QL query and returns the result as a future.- Parameters:
request
- the request to perform.options
- query options to use.- Returns:
- the mono once the result is complete.
-
targetedQueryRequest
@Internal public static QueryRequest targetedQueryRequest(String statement, byte[] queryBytes, String clientContextId, @Nullable NodeIdentifier target, boolean readonly, RetryStrategy retryStrategy, Duration timeout, RequestSpan parentSpan, Core core)Used by the transactions library, this provides some binary interface protection against QueryRequest/TargetedQueryRequest changing.
-